示例#1
0
 /// <summary>
 /// Resets the state of the button pressed by the player
 /// </summary>
 /// <param name="buttonKey"></param>
 /// <param name="player"></param>
 public static void ResetButton(XboxController.XboxButton button, IInputPlayer player)
 {
     if (player == null)
     {
         return;
     }
     else
     {
         xboxControllers[player.PlayerIndex].ResetButton(button);
     }
     Input.ResetInputAxes();
 }
示例#2
0
    /// <summary>
    /// Remaps/Updates the Xbox button dictionary with a new button
    /// </summary>
    /// <param name="buttonKey"></param>
    /// <param name="button"></param>
    /// <param name="player"></param>
    public static void RemapXboxButton(PlayerButton button, XboxController.XboxButton xButton, IInputPlayer player)
    {
        string buttonKey = button.ToString();

        // !!!NOTE!!! - Currently remapping xbox axis is not supported
        if (player == null)
        {
            return;
        }
        else
        {
            xboxButtonDictList[(int)player.PlayerIndex + 1][buttonKey] = xButton;
        }
    }
示例#3
0
    public void SetButton(XboxController.XboxButton passed)
    {
        List <string> xboxCodes = canvas.GetComponent <MenuOptions>().xboxCodes;

        player = GameObject.Find("Player").GetComponentInChildren <IInputPlayer>();
        foreach (string xKey in xboxCodes)
        {
            if (passed.ToString() == xKey)
            {
                return;
            }
        }
        InputManager.RemapXboxButton(action, passed, player);
        xboxCodes.Remove(keyName);
        keyName = passed.ToString();
        xboxCodes.Add(keyName);
        GetComponentInChildren <Text>().text = keyName;
    }