using Godot; using System; using DungeonRPG.Scripts.General; public partial class PlayerMoveState : Node { private Player characterNode; public override void _Ready() { characterNode = GetOwner(); SetPhysicsProcess(false); SetProcessInput(false); } public override void _PhysicsProcess(double delta) { if (characterNode.Direction == Vector2.Zero) { characterNode.StateMachine.SwitchState(); } } public override void _Input(InputEvent @event) { if (Input.IsActionJustPressed(GameConstants.INPUT_DASH)) { characterNode.StateMachine.SwitchState(); } } public override void _Notification(int what) { base._Notification(what); if (what == GameConstants.STATE_NOTIFICATION_ENABLE) { characterNode.AnimatedSprite.Play(GameConstants.ANIM_MOVE); SetPhysicsProcess(true); SetProcessInput(true); } else if (what == GameConstants.STATE_NOTIFICATION_DISABLE) { SetPhysicsProcess(false); SetProcessInput(false); } } }