Exemple #1
0
 public static bool GetKey(MyKeyCode c)
 {
     if (!mKeyStateMap.ContainsKey(c))
     {
         return(false);
     }
     return(mKeyStateMap[c] == MyKeyState.Down || mKeyStateMap[c] == MyKeyState.Held);
 }
Exemple #2
0
 public bool IsKeyHeld(MyKeyCode key)
 {
     if (isInitialized)
     {
         return(keyHeld[key]);
     }
     return(false);
 }
Exemple #3
0
 public static bool GetKeyUp(MyKeyCode c)
 {
     if (!mKeyStateMap.ContainsKey(c))
     {
         return(false);
     }
     return(mKeyStateMap[c] == MyKeyState.Up);
 }
Exemple #4
0
 public static void SetKeyUp(MyKeyCode c)
 {
     if (!mKeyStateMap.ContainsKey(c))
     {
         mKeyStateMap.Add(c, MyKeyState.Up);
         shouldUpdate.Add(c, false);
     }
     mKeyStateMap[c] = MyKeyState.Up;
     shouldUpdate[c] = false;
 }
Exemple #5
0
 private void RotateChange(MyKeyCode key)
 {
     if (key.Equals(MyKeyCode.Left))
     {
         ParticleSystem.shape.rotation.Set(0, 0, 75);
     }
     else
     {
         ParticleSystem.shape.rotation.Set(0, 0, -75);
     }
 }
Exemple #6
0
 public static bool GetKeyUp(MyKeyCode code)
 {
     if (!IsInputEnabled())
     {
         return(false);
     }
     else
     {
         return(Input.GetKeyUp((KeyCode)code));
     }
 }
Exemple #7
0
    ///<summary>
    ///True if you want to register Action on Key Down. False if on Key Up.
    ///</summary>
    public void RegisterKeyAction(MyKeyCode key, bool state, Action action)
    {
        if (!isInitialized)
        {
            InitKeysDict();
        }

        if (state)
        {
            keyDownActions[key].Register(action);
        }
        else
        {
            keyUpActions[key].Register(action);
        }
    }
Exemple #8
0
 ///<summary>
 ///True if you want to unregister Action on Key Down. False if on Key Up.
 ///</summary>
 public void UnregisterKeyAction(MyKeyCode key, bool state, Action action)
 {
     if (state)
     {
         if (keyDownActions.ContainsKey(key))
         {
             keyDownActions[key].Unregister(action);
         }
     }
     else
     {
         if (keyUpActions.ContainsKey(key))
         {
             keyUpActions[key].Unregister(action);
         }
     }
 }
Exemple #9
0
 public static bool IsKeyHeld(this MyKeyCode key)
 {
     return(STF.GameManager.InputController.IsKeyHeld(key));
 }
 public bool IsKeyHeld(MyKeyCode key)
 {
     return(keyHeld[key]);
 }