35 lines
861 B
C#
35 lines
861 B
C#
using SepCore.Definition;
|
|
|
|
namespace SepCore.Entity
|
|
{
|
|
/// <summary>
|
|
/// 闪电的攻击状态。
|
|
/// </summary>
|
|
public sealed class WeaponLightningAttackState : WeaponStateBase
|
|
{
|
|
private WeaponLightning _weapon;
|
|
|
|
public override WeaponStateType State => WeaponStateType.Attack;
|
|
|
|
public override void OnInit(WeaponBase weapon) => _weapon = (WeaponLightning)weapon;
|
|
|
|
public override void OnEnter()
|
|
{
|
|
_weapon.ResetAttackCooldown(_weapon.AttackCooldown);
|
|
_weapon.Attack();
|
|
}
|
|
|
|
public override void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
|
{
|
|
if (!_weapon.IsAttacking)
|
|
{
|
|
_weapon.TransitionTo(WeaponStateType.Aim);
|
|
}
|
|
}
|
|
|
|
public override void OnLeave()
|
|
{
|
|
}
|
|
}
|
|
}
|