2022-11-13 15:42:04 -08:00
|
|
|
using Godot;
|
2022-11-19 21:21:12 -08:00
|
|
|
using SupaLidlGame.Items;
|
2022-11-13 15:42:04 -08:00
|
|
|
|
|
|
|
namespace SupaLidlGame.Characters.State
|
|
|
|
{
|
|
|
|
public partial class PlayerMoveState : PlayerState
|
|
|
|
{
|
|
|
|
[Export]
|
2022-11-19 21:21:12 -08:00
|
|
|
public PlayerRollState RollState { get; set; }
|
2022-11-13 15:42:04 -08:00
|
|
|
|
|
|
|
public override CharacterState Enter(CharacterState previousState)
|
|
|
|
{
|
|
|
|
Godot.GD.Print("Started moving");
|
2022-11-19 21:21:12 -08:00
|
|
|
_player.Animation = "move";
|
2022-11-13 15:42:04 -08:00
|
|
|
return base.Enter(previousState);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override CharacterState Process(double delta)
|
|
|
|
{
|
|
|
|
base.Process(delta);
|
|
|
|
if (Character.Direction.LengthSquared() == 0)
|
|
|
|
{
|
|
|
|
return IdleState;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-11-18 13:53:51 -08:00
|
|
|
public override CharacterState Input(InputEvent @event)
|
2022-11-13 15:42:04 -08:00
|
|
|
{
|
|
|
|
if (@event.IsActionPressed("roll"))
|
|
|
|
{
|
2023-03-26 21:11:38 -07:00
|
|
|
if (!_player.IsUsingAnyWeapon())
|
2022-11-19 21:21:12 -08:00
|
|
|
{
|
|
|
|
return RollState;
|
|
|
|
}
|
2022-11-13 15:42:04 -08:00
|
|
|
}
|
2022-11-19 21:21:12 -08:00
|
|
|
return base.Input(@event);
|
2022-11-13 15:42:04 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|