FiE-Game/Assets/Scripts/Fie/Enemies/HoovesRaces/QueenChrysalis/FieStateMachineQueenChrysalisIgniteSucceed.cs

108 lines
2.5 KiB
C#
Raw Normal View History

2018-11-20 20:10:49 +01:00
using Fie.Object;
using GameDataEditor;
using Spine;
using System;
using System.Collections.Generic;
using UnityEngine;
2023-07-24 21:52:50 +02:00
using Event = Spine.Event;
2018-11-20 20:10:49 +01:00
namespace Fie.Enemies.HoovesRaces.QueenChrysalis
{
public class FieStateMachineQueenChrysalisIgniteSucceed : FieStateMachineGameCharacterBase
{
private enum SucceedState
{
SUCCEED_START,
SUCCEED_END
}
private Type _nextState = typeof(FieStateMachineCommonIdle);
private SucceedState _fireState;
private bool _isEnd;
private bool _isFinished;
public override void updateState<T>(ref T gameCharacter)
{
FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis;
if (!(chrysalis == null))
{
switch (_fireState)
{
case SucceedState.SUCCEED_START:
{
TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(19, isLoop: false, isForceSet: true);
chrysalis.SetDialog(100, FieMasterData<GDEWordScriptsListData>.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_1), FieMasterData<GDEWordScriptsListData>.I.GetMasterData(GDEItemKeys.WordScriptsList_E_THE_INSECT_QUEEN_USING_ABILITY_2));
if (trackEntry != null)
{
trackEntry.Complete += delegate
{
chrysalis.animationManager.SetAnimation(0, isLoop: true);
_nextState = typeof(FieStateMachineCommonIdle);
_isEnd = true;
};
2023-07-24 21:52:50 +02:00
trackEntry.Event += delegate(TrackEntry state, Event trackIndex)
2018-11-20 20:10:49 +01:00
{
2023-07-24 21:52:50 +02:00
if (trackIndex.Data.Name == "move")
2018-11-20 20:10:49 +01:00
{
2023-07-24 21:52:50 +02:00
Vector3 moveForce = chrysalis.flipDirectionVector * trackIndex.Float;
2018-11-20 20:10:49 +01:00
chrysalis.setMoveForce(moveForce, 0f, useRound: false);
}
2023-07-24 21:52:50 +02:00
if (trackIndex.Data.Name == "finished")
2018-11-20 20:10:49 +01:00
{
_nextState = typeof(FieStateMachineCommonIdle);
_isEnd = true;
}
};
}
else
{
_isEnd = true;
}
_fireState = SucceedState.SUCCEED_END;
break;
}
}
}
}
public override void initialize(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = false;
}
}
public override void terminate(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = true;
}
}
public override List<Type> getAllowedStateList()
{
return new List<Type>();
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return _nextState;
}
public override bool isFinished()
{
return _isFinished;
}
}
}