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 FieStateMachineQueenChrysalisHormingShot : FieStateMachineGameCharacterBase
|
|
|
|
{
|
|
|
|
private enum ShootState
|
|
|
|
{
|
|
|
|
STATE_PREPARE,
|
|
|
|
STATE_SHOOT
|
|
|
|
}
|
|
|
|
|
|
|
|
private ShootState _shootState;
|
|
|
|
|
|
|
|
private bool _isEnd;
|
|
|
|
|
|
|
|
private FieEmitObjectQueenChrysalisHornEffect _hornEffect;
|
|
|
|
|
|
|
|
public override void initialize(FieGameCharacter gameCharacter)
|
|
|
|
{
|
|
|
|
gameCharacter.isEnableAutoFlip = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void terminate(FieGameCharacter gameCharacter)
|
|
|
|
{
|
|
|
|
FieQueenChrysalis fieQueenChrysalis = gameCharacter as FieQueenChrysalis;
|
|
|
|
if (!(fieQueenChrysalis == null))
|
|
|
|
{
|
|
|
|
if ((bool)_hornEffect)
|
|
|
|
{
|
|
|
|
_hornEffect.Kill();
|
|
|
|
}
|
|
|
|
fieQueenChrysalis._isEffectivePull = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void updateState<T>(ref T gameCharacter)
|
|
|
|
{
|
|
|
|
FieQueenChrysalis chrysalis = gameCharacter as FieQueenChrysalis;
|
|
|
|
if (!(chrysalis == null))
|
|
|
|
{
|
|
|
|
if (chrysalis.detector.getLockonEnemyTransform() == null)
|
|
|
|
{
|
|
|
|
_isEnd = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ShootState shootState = _shootState;
|
|
|
|
if (shootState == ShootState.STATE_PREPARE)
|
|
|
|
{
|
|
|
|
TrackEntry trackEntry = chrysalis.animationManager.SetAnimation(28, isLoop: false, isForceSet: true);
|
|
|
|
FieEmitObjectQueenChrysalisShootingConcentration concentRation = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectQueenChrysalisShootingConcentration>(chrysalis.hornTransform, chrysalis.flipDirectionVector, chrysalis.detector.getLockonEnemyTransform(isCenter: true));
|
|
|
|
_hornEffect = FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectQueenChrysalisHornEffect>(chrysalis.hornTransform, Vector3.zero, null, chrysalis);
|
|
|
|
chrysalis._isEffectivePull = true;
|
|
|
|
if (trackEntry != null)
|
|
|
|
{
|
|
|
|
autoFlipToEnemy(chrysalis);
|
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<FieEmitObjectQueenChrysalisHormingShot>(chrysalis.hornTransform, chrysalis.flipDirectionVector, chrysalis.detector.getLockonEnemyTransform(isCenter: true), chrysalis);
|
|
|
|
FieManagerBehaviour<FieEmittableObjectManager>.I.EmitObject<FieEmitObjectQueenChrysalisHormingShotActivateEffect>(chrysalis.hornTransform, Vector3.zero, null);
|
|
|
|
chrysalis._isEffectivePull = false;
|
|
|
|
}
|
2023-07-24 21:52:50 +02:00
|
|
|
if (trackIndex.Data.Name == "move")
|
2018-11-20 20:10:49 +01:00
|
|
|
{
|
|
|
|
Vector3 flipDirectionVector = chrysalis.flipDirectionVector;
|
2023-07-24 21:52:50 +02:00
|
|
|
Vector3 moveForce = flipDirectionVector * trackIndex.Float;
|
2018-11-20 20:10:49 +01:00
|
|
|
chrysalis.resetMoveForce();
|
|
|
|
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
|
|
|
{
|
|
|
|
if ((bool)_hornEffect)
|
|
|
|
{
|
|
|
|
_hornEffect.Kill();
|
|
|
|
}
|
|
|
|
concentRation.StopEffect();
|
|
|
|
_isEnd = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
trackEntry.Complete += delegate
|
|
|
|
{
|
|
|
|
_isEnd = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_isEnd = true;
|
|
|
|
}
|
|
|
|
_shootState = ShootState.STATE_SHOOT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool isEnd()
|
|
|
|
{
|
|
|
|
return _isEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override Type getNextState()
|
|
|
|
{
|
|
|
|
return typeof(FieStateMachineQueenChrysalisPenetrateShot);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override List<Type> getAllowedStateList()
|
|
|
|
{
|
|
|
|
List<Type> list = new List<Type>();
|
|
|
|
list.Add(typeof(FieStateMachineQueenChrysalisPenetrateShot));
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|