VladimirPirozhenko 6999e84b65 Added pause and pause view, added restriction of input while in paused state
Upgraded Input system to fit demands of paused game (no movement inputs allowed!)
2022-08-12 05:38:17 +03:00

28 lines
741 B
C#

using UnityEngine;
public class KeyBinding : IBinding
{
private KeyCode keyBinding;
private KeyCode alternativeKeyBinding;
public bool IsPressed => Input.GetKeyDown(keyBinding) || Input.GetKeyDown(alternativeKeyBinding);
public bool IsReleased => Input.GetKeyUp(keyBinding) || Input.GetKeyUp(alternativeKeyBinding);
public bool IsRestricted { get; set; }
public KeyBinding(KeyCode key,KeyCode alternative = KeyCode.None)
{
keyBinding = key;
alternativeKeyBinding = alternative;
IsRestricted = false;
}
public void UpdateBinding(KeyCode key)
{
keyBinding = key;
}
public void UpdateAlternativeBinding(KeyCode key)
{
keyBinding = key;
}
}