// Update is called once per frame void Update() { /******************** * PRESSED *******************/ // Interaction button if (this.KeyPressed("Interact")) { //Debug.Log("Interact pressed"); PlayerStatus.interaction = true; } else { PlayerStatus.interaction = false; } // Open Backpack if (this.KeyPressed("Backpack")) { PlayerGuiController.ToggleShowBackpack(); } /******************** * HELD *******************/ if (this.KeyHold("ShowTooltip")) { PlayerGuiController.show_tooltip_btn = true; } else { PlayerGuiController.show_tooltip_btn = false; } }
public KeyBinding Key = new KeyBinding(); // key binding of current player /// <summary> /// Initialize variables and key bindings /// </summary> void Awake() { guiController = GetComponent <PlayerGuiController>(); playerAudio = GetComponent <AudioSource>(); Key.Register("inventory", KeyCode.E); for (int i = 0; i < 10; i++) { Key.Register(i.ToString(), (KeyCode)System.Enum.Parse(typeof(KeyCode), "Alpha" + i)); } Key.Register("use", KeyCode.R); Key.Register("close", KeyCode.Escape); }