mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 23:35:54 +00:00
FSM Test
This commit is contained in:
parent
f1f40a91dd
commit
af46098aca
9 changed files with 414 additions and 145 deletions
|
|
@ -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,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue