public bool GetButtonUp(ControllerInputManager.eControllerId controllerId, BaseController.eButtonId buttonId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return(m_Controllers[controllerId].GetButtonUp(buttonId));
        }

        return(false);
    }
    public Vector2 GetMotion(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return(m_Controllers[controllerId].GetMotion());
        }

        return(Vector2.zero);
    }
    public bool GetButtonUp(ControllerInputManager.eControllerId controllerId, string alias)
    {
        if (m_ButtonAliases.ContainsKey(alias))
        {
            return(GetButtonUp(controllerId, m_ButtonAliases[alias]));
        }

        return(false);
    }
    public float GetR2(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return(m_Controllers[controllerId].GetR2());
        }

        return(-1.0f);
    }
    public Vector2 GetRightJoystick(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return(m_Controllers[controllerId].GetRightJoystick());
        }

        return(Vector2.zero);
    }
    public bool RemoveController(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return(m_Controllers.Remove(controllerId));
        }

        return(false);
    }
    public BaseController GetController(ControllerInputManager.eControllerId controllerId)
    {
        if (m_Controllers.ContainsKey(controllerId))
        {
            return(m_Controllers[controllerId]);
        }

        return(null);
    }
    public List <BaseController.eButtonId> GetButtonUp(ControllerInputManager.eControllerId controllerId)
    {
        List <BaseController.eButtonId> buttons = new List <BaseController.eButtonId>();

        if (m_Controllers.ContainsKey(controllerId))
        {
            foreach (BaseController.eButtonId buttonId in System.Enum.GetValues(typeof(BaseController.eButtonId)))
            {
                // NOTE ppoirier: I had to do the Contains check for some reason.
                if (!buttons.Contains(buttonId) && GetButtonUp(controllerId, buttonId))
                {
                    buttons.Add(buttonId);
                }
            }
        }

        return(buttons);
    }
示例#9
0
    public bool IsPlayerController(CharacterController.ePlayerId playerId, ControllerInputManager.eControllerId controllerId)
    {
        if (controllerId == ControllerInputManager.Instance.MouseControllerId)
        {
            return(playerId == ePlayerId.PLAYER_1);
        }
        else if (controllerId == ControllerInputManager.Instance.Keyboard1ControllerId)
        {
            return(playerId == ePlayerId.PLAYER_1);
        }
        else if (controllerId == ControllerInputManager.Instance.Keyboard2ControllerId)
        {
            return(GameUtils.m_GameMode == GameUtils.eGameMode.TWO_PLAYER && playerId == ePlayerId.PLAYER_2);
        }
        else if ((playerId == ePlayerId.PLAYER_1 && controllerId == ControllerInputManager.eControllerId.CONTROLLER_01) ||
                 (playerId == ePlayerId.PLAYER_2 && controllerId == ControllerInputManager.eControllerId.CONTROLLER_02))
        {
            return(true);
        }

        return(false);
    }