예제 #1
0
 internal void reactToKeyUp(object sender, KeyEventArgs e)
 {
     if (KeyBindings.ContainsKey(e.KeyCode))
     {
         CurrentState = CurrentState.removeState(KeyBindings[e.KeyCode]);
     }
 }
예제 #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]);
            }
        }
예제 #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);
                }
            }
        }
예제 #4
0
 public bool RemoveKeyBinding(Keys key)
 {
     if (KeyBindings.ContainsKey(key))
     {
         return(false);
     }
     KeyBindings.Remove(key);
     return(true);
 }
예제 #5
0
 public bool AddKeyBinding(Keys key, InputType inputType)
 {
     if (KeyBindings.ContainsKey(key))
     {
         return(false);
     }
     KeyBindings.Add(key, inputType);
     return(true);
 }
예제 #6
0
 public void AddScoresKeyBinding(ScoresRange scoresRange, GamepadButtons button)
 {
     if (KeyBindings.ContainsKey(button))
     {
         KeyBindings[button] = scoresRange;
     }
     else
     {
         KeyBindings.Add(button, scoresRange);
     }
 }
예제 #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._);
     }
 }