Example #1
0
 internal void reactToKeyUp(object sender, KeyEventArgs e)
 {
     if (KeyBindings.ContainsKey(e.KeyCode))
     {
         CurrentState = CurrentState.removeState(KeyBindings[e.KeyCode]);
     }
 }
Example #2
0
        //Methods for interaction with the Form

        public void reactToKeyDown(object sender, KeyEventArgs e)
        {
            if (KeyBindings.ContainsKey(e.KeyCode))
            {
                CurrentState = CurrentState.changeState(KeyBindings[e.KeyCode]);
            }
        }
Example #3
0
        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);
                }
            }
        }
Example #4
0
 public bool RemoveKeyBinding(Keys key)
 {
     if (KeyBindings.ContainsKey(key))
     {
         return(false);
     }
     KeyBindings.Remove(key);
     return(true);
 }
Example #5
0
 public bool AddKeyBinding(Keys key, InputType inputType)
 {
     if (KeyBindings.ContainsKey(key))
     {
         return(false);
     }
     KeyBindings.Add(key, inputType);
     return(true);
 }
Example #6
0
 public void AddScoresKeyBinding(ScoresRange scoresRange, GamepadButtons button)
 {
     if (KeyBindings.ContainsKey(button))
     {
         KeyBindings[button] = scoresRange;
     }
     else
     {
         KeyBindings.Add(button, scoresRange);
     }
 }
Example #7
0
 public Keys GetKey(string key)
 {
     if (Keyboard.ContainsKey(key))
     {
         return(Keyboard[key]);
     }
     else
     {
         UnityEngine.Debug.Log("Does not contain this string: " + key);
         return(Keys._);
     }
 }