Skip to content

Commit

Permalink
Added debug variable for current player state
Browse files Browse the repository at this point in the history
This makes the value of `CurrentState` visible in the inspector, but unable to be written to.
  • Loading branch information
ddabble committed Oct 11, 2021
1 parent 3220f55 commit 8ee029e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Assets/Scripts/Player/PlayerStateController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public enum PlayerStates
public partial class PlayerStateController : MonoBehaviour
{
private HealthLogic health; // Reference to the health script
private PlayerStates _currentState;
private PlayerSpecificManager manager;
private PlayerMotion motion;
private PlayerUi ui;
Expand All @@ -39,7 +40,14 @@ public partial class PlayerStateController : MonoBehaviour
[SerializeField]
private Transform heldItemBone;

public PlayerStates CurrentState { get; private set; } = PlayerStates.FREE;
#region State variables for debugging

[ReadOnly]
public PlayerStates currentStateReadOnly;

#endregion State variables for debugging

public PlayerStates CurrentState { get => _currentState; private set => currentStateReadOnly = _currentState = value; }

public delegate void PlayerStateDelegate(PlayerStates newState, PlayerStates oldState);

Expand All @@ -53,6 +61,8 @@ void Start()
ui = GetComponent<PlayerUi>();
terrain = GameObject.FindGameObjectWithTag("Grid").GetComponent<HexGrid>();
inventoryManager = InventoryManager.Singleton;

CurrentState = PlayerStates.FREE;
}

void FixedUpdate()
Expand Down

0 comments on commit 8ee029e

Please sign in to comment.