FiE-Game/Assets/Scripts/Fie/Enemies/HoovesRaces/ChangelingAlpha/FieStateMachineChangelingAlphaCharge.cs

82 lines
2.2 KiB
C#
Raw Normal View History

2018-11-20 20:10:49 +01:00
using Fie.Manager;
using Fie.Object;
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.ChangelingAlpha
{
public class FieStateMachineChangelingAlphaCharge : FieStateMachineGameCharacterBase
{
private const float MOVE_THRESHOLD = 0.02f;
private const float WALK_FORCE_THRESHOLD = 0.3f;
private const float WALK_MOVESPEED_MAGNI = 0.25f;
private bool _isEnd;
private Type _nextState;
public override void updateState<T>(ref T gameCharacter)
{
FieChangelingAlpha changelingAlpha = gameCharacter as FieChangelingAlpha;
if ((object)changelingAlpha != null)
{
Vector3 externalInputVector = changelingAlpha.externalInputVector;
externalInputVector.z = externalInputVector.y * 0.5f;
externalInputVector.y = 0f;
float defaultMoveSpeed = changelingAlpha.getDefaultMoveSpeed();
TrackEntry trackEntry = changelingAlpha.animationManager.SetAnimation(13, isLoop: true);
if (trackEntry != null)
{
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 == "fire")
2018-11-20 20:10:49 +01:00
{
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaChargeEffect>(changelingAlpha.centerTransform, changelingAlpha.flipDirectionVector);
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectChangelingAlphaCharge>(changelingAlpha.centerTransform, changelingAlpha.flipDirectionVector, null, changelingAlpha);
}
};
}
changelingAlpha.addMoveForce(externalInputVector * (defaultMoveSpeed * changelingAlpha.externalInputForce), 0.4f);
}
}
public override void initialize(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = true;
}
}
public override void terminate(FieGameCharacter gameCharacter)
{
if (!(gameCharacter == null))
{
gameCharacter.isEnableAutoFlip = false;
}
}
public override bool isEnd()
{
return _isEnd;
}
public override Type getNextState()
{
return _nextState;
}
public override List<Type> getAllowedStateList()
{
List<Type> list = new List<Type>();
list.Add(typeof(FieStateMachineAnyConsider));
return list;
}
}
}