SupaLidlGame/State/Weapon/RangedFireState.cs

39 lines
877 B
C#
Raw Normal View History

2023-05-26 22:28:08 -07:00
using Godot;
namespace SupaLidlGame.State.Weapon
{
public partial class RangedFireState : WeaponState
{
[Export]
public Items.Weapons.Ranged Weapon { get; set; }
[Export]
public RangedIdleState IdleState { get; set; }
private double _timeLeft = 0;
public override IState<WeaponState> Enter(IState<WeaponState> prev)
{
//_timeLeft
_timeLeft = Weapon.UseTime;
Weapon.Attack();
2023-05-28 17:54:48 -07:00
Weapon.UseDirection = Weapon.Character.Target;
2023-05-26 22:28:08 -07:00
return null;
}
public override WeaponState Process(double delta)
{
if ((_timeLeft -= delta) <= 0)
{
return IdleState;
}
return null;
}
public override void Exit(IState<WeaponState> nextState)
{
}
}
}