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.QueenChrysalis
|
|
|
|
{
|
|
|
|
public class FieStateMachineQueenChrysalisCrucible : FieStateMachineGameCharacterBase
|
|
|
|
{
|
|
|
|
private enum AttackState
|
|
|
|
{
|
|
|
|
KICK_START,
|
|
|
|
KICK,
|
|
|
|
FLYBY,
|
|
|
|
FINISHED
|
|
|
|
}
|
|
|
|
|
|
|
|
private Type _nextState = typeof(FieStateMachineQueenChrysalisIdle);
|
|
|
|
|
|
|
|
private AttackState _attackingState;
|
|
|
|
|
|
|
|
private bool _isEnd;
|
|
|
|
|
|
|
|
private bool _isMidAirAttack;
|
|
|
|
|
|
|
|
private int _attackCount;
|
|
|
|
|
|
|
|
private FieEmitObjectQueenChrysalisHornEffect _hornEffect;
|
|
|
|
|
|
|
|
private List<Vector3> _hittedPosition = new List<Vector3>();
|
|
|
|
|
|
|
|
public override void initialize(FieGameCharacter gameCharacter)
|
|
|
|
{
|
|
|
|
FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis;
|
|
|
|
if (!(fieQueenChrysalis == null))
|
|
|
|
{
|
|
|
|
autoFlipToEnemy(fieQueenChrysalis);
|
|
|
|
fieQueenChrysalis.isEnableAutoFlip = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void terminate(FieGameCharacter gameCharacter)
|
|
|
|
{
|
|
|
|
if (!(gameCharacter == null))
|
|
|
|
{
|
|
|
|
gameCharacter.isEnableAutoFlip = true;
|
|
|
|
gameCharacter.isEnableGravity = true;
|
|
|
|
gameCharacter.isEnableCollider = true;
|
|
|
|
if ((bool)_hornEffect)
|
|
|
|
{
|
|
|
|
_hornEffect.Kill();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void updateState<T>(ref T gameCharacter)
|
|
|
|
{
|
|
|
|
if (gameCharacter is FieQueenChrysalis)
|
|
|
|
{
|
|
|
|
FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis;
|
|
|
|
switch (_attackingState)
|
|
|
|
{
|
|
|
|
case AttackState.KICK_START:
|
|
|
|
if (chrysalis.groundState != 0)
|
|
|
|
{
|
|
|
|
_isEnd = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TrackEntry trackEntry2 = chrysalis.animationManager.SetAnimation(16, isLoop: false, isForceSet: true);
|
|
|
|
_hornEffect = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectQueenChrysalisHornEffect>(chrysalis.hornTransform, Vector3.zero, null);
|
|
|
|
if (trackEntry2 != null)
|
|
|
|
{
|
2023-07-24 21:52:50 +02:00
|
|
|
trackEntry2.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
|
|
|
{
|
|
|
|
FieEmitObjectQueenChrysalisCrucibleCircle fieEmitObjectQueenChrysalisCrucibleCircle = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectQueenChrysalisCrucibleCircle>(chrysalis.leftFrontHoofTransform, Vector3.forward, null, chrysalis);
|
|
|
|
if (fieEmitObjectQueenChrysalisCrucibleCircle != null)
|
|
|
|
{
|
|
|
|
fieEmitObjectQueenChrysalisCrucibleCircle.transform.rotation = Quaternion.identity;
|
|
|
|
fieEmitObjectQueenChrysalisCrucibleCircle.hitEvent += CrucibleCircle_hitEvent;
|
|
|
|
}
|
|
|
|
if ((bool)_hornEffect)
|
|
|
|
{
|
|
|
|
_hornEffect.Kill();
|
|
|
|
}
|
|
|
|
}
|
2023-07-24 21:52:50 +02:00
|
|
|
if (trackIndex.Data.Name == "finished")
|
2018-11-20 20:10:49 +01:00
|
|
|
{
|
|
|
|
_attackingState = AttackState.FLYBY;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
trackEntry2.Complete += delegate
|
|
|
|
{
|
|
|
|
_attackingState = AttackState.FLYBY;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_isEnd = true;
|
|
|
|
}
|
|
|
|
_attackingState = AttackState.KICK;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case AttackState.FLYBY:
|
|
|
|
{
|
|
|
|
if ((bool)_hornEffect)
|
|
|
|
{
|
|
|
|
_hornEffect.Kill();
|
|
|
|
}
|
|
|
|
TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(15, isLoop: false, isForceSet: 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
|
|
|
{
|
|
|
|
foreach (Vector3 item in _hittedPosition)
|
|
|
|
{
|
|
|
|
FieEmitObjectQueenChrysalisCrucibleBurst fieEmitObjectQueenChrysalisCrucibleBurst = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectQueenChrysalisCrucibleBurst>(chrysalis.transform, Vector3.zero, null, chrysalis);
|
|
|
|
fieEmitObjectQueenChrysalisCrucibleBurst.transform.position = item;
|
|
|
|
}
|
|
|
|
}
|
2023-07-24 21:52:50 +02:00
|
|
|
if (trackIndex.Data.Name == "activate")
|
2018-11-20 20:10:49 +01:00
|
|
|
{
|
|
|
|
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectQueenChrysalisCommonActivationEffect>(chrysalis.leftFrontHoofTransform, Vector3.zero, null, chrysalis);
|
|
|
|
}
|
2023-07-24 21:52:50 +02:00
|
|
|
if (trackIndex.Data.Name == "move")
|
2018-11-20 20:10:49 +01:00
|
|
|
{
|
|
|
|
chrysalis.isEnableGravity = false;
|
2023-07-24 21:52:50 +02:00
|
|
|
Vector3 moveForce = Vector3.up * trackIndex.Float;
|
2018-11-20 20:10:49 +01:00
|
|
|
chrysalis.setMoveForce(moveForce, 0.5f);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
trackEntry.Complete += delegate
|
|
|
|
{
|
|
|
|
_nextState = typeof(FieStateMachineQueenChrysalisJumpIdle);
|
|
|
|
_isEnd = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
_attackingState = AttackState.FINISHED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void CrucibleCircle_hitEvent(Vector3 point)
|
|
|
|
{
|
|
|
|
_hittedPosition.Add(point);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool isEnd()
|
|
|
|
{
|
|
|
|
return _isEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override Type getNextState()
|
|
|
|
{
|
|
|
|
return typeof(FieStateMachineCommonIdle);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override List<Type> getAllowedStateList()
|
|
|
|
{
|
|
|
|
return new List<Type>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|