SupaLidlGame/State/Weapon/WeaponStateMachine.cs

61 lines
1.2 KiB
C#
Raw Normal View History

2023-05-23 00:23:53 -07:00
using Godot;
2023-06-03 18:21:46 -07:00
namespace SupaLidlGame.State.Weapon;
public partial class WeaponStateMachine : StateMachine<WeaponState>
2023-05-23 00:23:53 -07:00
{
2023-06-03 18:21:46 -07:00
[Export]
public override WeaponState InitialState { get; set; }
2023-05-23 00:23:53 -07:00
2023-08-10 23:08:41 -07:00
[Export]
public Godot.Collections.Array<NodePath> UsedItemStates { get; protected set; }
[Export]
public Godot.Collections.Array<NodePath> DeusedItemStates { get; protected set; }
2023-06-03 18:21:46 -07:00
public void Use()
{
var state = CurrentState.Use();
if (state is WeaponState)
2023-05-23 00:23:53 -07:00
{
2023-06-03 18:21:46 -07:00
ChangeState(state);
2023-05-26 22:28:08 -07:00
}
2023-06-03 18:21:46 -07:00
}
2023-05-26 22:28:08 -07:00
2023-06-03 18:21:46 -07:00
public void Deuse()
{
var state = CurrentState.Deuse();
if (state is WeaponState)
2023-05-26 22:28:08 -07:00
{
2023-06-03 18:21:46 -07:00
ChangeState(state);
2023-05-23 00:23:53 -07:00
}
2023-06-03 18:21:46 -07:00
}
2023-05-23 00:23:53 -07:00
2023-08-08 00:54:00 -07:00
public void UseAlt()
{
var state = CurrentState.UseAlt();
if (state is WeaponState)
{
ChangeState(state);
}
}
public void DeuseAlt()
{
var state = CurrentState.DeuseAlt();
if (state is WeaponState)
{
ChangeState(state);
}
}
2023-06-03 18:21:46 -07:00
public void Process(double delta)
{
var state = CurrentState.Process(delta);
if (state is WeaponState s)
2023-05-23 00:23:53 -07:00
{
2023-06-03 18:21:46 -07:00
ChangeState(s);
2023-05-23 00:23:53 -07:00
}
}
}