Ejemplo n.º 1
0
 public static void AddMouseInput(FpsInput input, int mouseButton)
 {
     if (s_mouseInputs.ContainsKey(input))
     {
         s_mouseInputs[input] = mouseButton;
     }
     else
     {
         s_mouseInputs.Add(input, mouseButton);
     }
 }
Ejemplo n.º 2
0
 public static void AddKeyboardInput(FpsInput input, KeyCode key)
 {
     if (s_keyboardInputs.TryGetValue(input, out s_keysToCheck) == false)
     {
         s_keyboardInputs.Add(input, new HashSet <KeyCode>()
         {
             key
         });
     }
     else
     {
         s_keysToCheck.Add(key);
     }
 }
Ejemplo n.º 3
0
 public static KeyCode GetKeyboardInput(FpsInput input)
 {
     if (s_keyboardInputs.TryGetValue(input, out s_keysToCheck))
     {
         KeyCode value = KeyCode.Question;
         // get the first thing we find and exit the loop
         foreach (KeyCode code in s_keysToCheck)
         {
             value = code;
             break;
         }
         return(value);
     }
     Debug.LogWarningFormat("FpsControl.GetKeyboardInput: No entry found for FpsInput.{0}", input.ToString());
     return(KeyCode.Question);
 }
Ejemplo n.º 4
0
        public static bool WasReleasedThisFrame(FpsInput input)
        {
            int mouseButton = 0;

            if (s_mouseInputs.TryGetValue(input, out mouseButton) && Input.GetMouseButtonUp(mouseButton))
            {
                return(true);
            }
            if (s_keyboardInputs.TryGetValue(input, out s_keysToCheck))
            {
                foreach (KeyCode key in s_keysToCheck)
                {
                    if (Input.GetKeyUp(key))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 5
0
        public static bool IsPressed(FpsInput input)
        {
            int mouseButton = 0;

            if (s_mouseInputs.TryGetValue(input, out mouseButton) && Input.GetMouseButton(mouseButton))
            {
                return(true);
            }
            if (s_keyboardInputs.TryGetValue(input, out s_keysToCheck))
            {
                foreach (KeyCode key in s_keysToCheck)
                {
                    if (Input.GetKey(key))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }