示例#1
0
 public static bool GetKey(MyKeyCode c)
 {
     if (!mKeyStateMap.ContainsKey(c))
     {
         return(false);
     }
     return(mKeyStateMap[c] == MyKeyState.Down || mKeyStateMap[c] == MyKeyState.Held);
 }
示例#2
0
 public bool IsKeyHeld(MyKeyCode key)
 {
     if (isInitialized)
     {
         return(keyHeld[key]);
     }
     return(false);
 }
示例#3
0
 public static bool GetKeyUp(MyKeyCode c)
 {
     if (!mKeyStateMap.ContainsKey(c))
     {
         return(false);
     }
     return(mKeyStateMap[c] == MyKeyState.Up);
 }
示例#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;
 }
示例#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);
     }
 }
示例#6
0
 public static bool GetKeyUp(MyKeyCode code)
 {
     if (!IsInputEnabled())
     {
         return(false);
     }
     else
     {
         return(Input.GetKeyUp((KeyCode)code));
     }
 }
示例#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);
        }
    }
示例#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);
         }
     }
 }
示例#9
0
 public static bool IsKeyHeld(this MyKeyCode key)
 {
     return(STF.GameManager.InputController.IsKeyHeld(key));
 }
示例#10
0
 public bool IsKeyHeld(MyKeyCode key)
 {
     return(keyHeld[key]);
 }