Ejemplo n.º 1
0
 public static bool GetButtonUp(string button, INPUT_CONTEXT context)
 {
     if (contextStack.Peek() == context)
     {
         return Input.GetButtonUp(button);
     }
     return false;
 }
Ejemplo n.º 2
0
 public static bool GetKey(KeyCode key, INPUT_CONTEXT context)
 {
     if (contextStack.Peek() == context)
     {
         return Input.GetKey(key);
     }
     return false;
 }
Ejemplo n.º 3
0
 public static float GetAxisRaw(string axis, INPUT_CONTEXT context)
 {
     if (contextStack.Peek() == context)
     {
         return Input.GetAxisRaw(axis);
     }
     return 0;
 }
Ejemplo n.º 4
0
    /// <summary>
    /// Pushes an input context onto the stack. We don't push if it already exists.
    /// </summary>
    /// <param name="context"></param>
    public static void PushInputContext(INPUT_CONTEXT context)
    {
        if (context == contextStack.Peek())
        {
            Debug.Log("[InputManager.cs] Context is already " + contextStack.Peek().ToString());
            return;
        }

        contextStack.Push(context);
        Debug.Log("[InputManager.cs] Added context " + contextStack.Peek().ToString());
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Pops an input context off of the stack. If it's not on the top, we don't pop.
    /// </summary>
    /// <param name="context"></param>
    public static void PopInputContext(INPUT_CONTEXT context)
    {
        if (contextStack.Count == 0)
        {
            contextStack.Push(INPUT_CONTEXT.NONE);
            return;
        }

        if (contextStack.Peek() == context)
        {
            INPUT_CONTEXT removedContext = contextStack.Pop();
            Debug.Log("InputManger: Removed context " + removedContext.ToString());
        }
    }
Ejemplo n.º 6
0
 /// <summary>
 /// Determines whether the provided context is on the current
 /// input context stack.
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public static bool HasContext(INPUT_CONTEXT context)
 {
     return contextStack.Contains(context);
 }
Ejemplo n.º 7
0
 public static bool GetMouseButtonDown(int button, INPUT_CONTEXT context)
 {
     if (contextStack.Peek() == context)
     {
         return Input.GetMouseButtonDown(button);
     }
     return false;
 }