A library for handling input using plyr4/unity-event-system.
- Create a game object and attach a
PlayerInput
monobehaviour.
When adding a new action add boiler plate code to the following files:
GameInput.cs
Use the singleton.
if (GameInput.Instance._firePressed)
Wrap with GameState
public bool ShouldReceiveInput()
{
if (!_viewParent.activeSelf) return false;
switch (GStateMachineGame.Instance.CurrentState())
{
case GStatePause _: return true;
default: return false;
}
}
public void Update()
{
if (!ShouldReceiveInput()) return;
if (GameInput.Instance._firePressed)
{
// do something
}
}