This commit is contained in:
Maddo 2025-02-28 13:50:52 +01:00
commit af46098aca
9 changed files with 414 additions and 145 deletions

View file

@ -64,6 +64,8 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
[Export] private GpuParticles2D _shieldParticles;
public Weapon EquippedWeapon { get; set; }
private PlayerState _state;
public Array<Weapon> EquippedWeapons { get; set; } = new Array<Weapon>();
public int CurrentWeaponIndex { get; set; } = 0;
@ -124,6 +126,8 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
// CurrentHealth = MaxHealth;
// CurrentShield = MaxShield;
_state = PlayerState.Active;
_animatedSprite = GetNode<AnimatedSprite2D>("./Smoothing2D/AnimatedSprite2D");
_crosshair = GetNode<Sprite2D>("./Smoothing2D/Crosshair");
@ -171,17 +175,22 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
switch (state)
{
case GameState.Menu:
break;
case GameState.Paused:
_canMove = false;
_state = PlayerState.Paused;
break;
case GameState.Playing:
_canMove = true;
_state = PlayerState.Active;
break;
case GameState.Dialogue:
_canMove = false;
_state = PlayerState.Paused;
break;
case GameState.Controlling:
_canMove = false;
_state = PlayerState.Controlling;
break;
}
}
@ -601,3 +610,11 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
}
}
public enum PlayerState
{
Active,
Paused,
Controlling,
Dead,
}