NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Vehicle/State/VehicleStateIdle.cs

50 lines
1.4 KiB
C#

using Gameplay.Vehicle.Impl;
using LTGame;
namespace Gameplay.Vehicle.State
{
public class VehicleStateIdle: BaseVehicleState
{
public VehicleStateIdle(NormalVehicle owner) : base(owner, EVehicleState.Idle)
{
}
protected override void _OnEnter(NBaseState exitState,
object param)
{
base._OnEnter(exitState, param);
owner.vAnim.targetAnim = "idle";
}
protected override void _OnRunning()
{
base._OnRunning();
if (owner.aliveData.currentHp <= 0)
{
isFinished = true;
nextState = EVehicleState.Destroy;
return;
}
if (owner.controlData.targetCellIndex == -1
&& owner.controlData.followUnit != null
&& owner.controlData.targetEnemy != owner.controlData.followUnit)
{
var followCellIndex = owner.controlData.followUnit.transData.cellIndex;
owner.controlData.targetCellIndex = followCellIndex;
// DebugUtil.LogError("重设目标点:" + followCellIndex);
}
if (owner.controlData.targetCellIndex != -1)
{
isFinished = true;
nextState = EVehicleState.Move;
return;
}
}
}
}