internal void reactToKeyUp(object sender, KeyEventArgs e) { if (KeyBindings.ContainsKey(e.KeyCode)) { CurrentState = CurrentState.removeState(KeyBindings[e.KeyCode]); } }
//Methods for interaction with the Form public void reactToKeyDown(object sender, KeyEventArgs e) { if (KeyBindings.ContainsKey(e.KeyCode)) { CurrentState = CurrentState.changeState(KeyBindings[e.KeyCode]); } }
public void SetHit(GamepadButtons button) { if (!KeyBindings.ContainsKey(button)) { return; } if (!HitBindings.ContainsKey(KeyBindings[button])) { return; } ushort hitsAmount = HitBindings[KeyBindings[button]]; if (Scores + hitsAmount < short.MaxValue) { Scores += hitsAmount; } _setHitAction?.Invoke(); if (SoundBindings.ContainsKey(KeyBindings[button])) { string soundFile = SoundBindings[KeyBindings[button]]; if (!string.IsNullOrEmpty(soundFile) && !string.IsNullOrWhiteSpace(soundFile)) { _soundAction(soundFile); } } }
public bool RemoveKeyBinding(Keys key) { if (KeyBindings.ContainsKey(key)) { return(false); } KeyBindings.Remove(key); return(true); }
public bool AddKeyBinding(Keys key, InputType inputType) { if (KeyBindings.ContainsKey(key)) { return(false); } KeyBindings.Add(key, inputType); return(true); }
public void AddScoresKeyBinding(ScoresRange scoresRange, GamepadButtons button) { if (KeyBindings.ContainsKey(button)) { KeyBindings[button] = scoresRange; } else { KeyBindings.Add(button, scoresRange); } }
public Keys GetKey(string key) { if (Keyboard.ContainsKey(key)) { return(Keyboard[key]); } else { UnityEngine.Debug.Log("Does not contain this string: " + key); return(Keys._); } }