当前位置: 首页>>代码示例>>C#>>正文


C# InputManager.BindButton方法代码示例

本文整理汇总了C#中InputManager.BindButton方法的典型用法代码示例。如果您正苦于以下问题:C# InputManager.BindButton方法的具体用法?C# InputManager.BindButton怎么用?C# InputManager.BindButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputManager的用法示例。


在下文中一共展示了InputManager.BindButton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    private void Start()
    {
        m_InputManager = InputManager.Instance;

        //I need to make a generic BindButton function for controllers
        for (int i = 0; i < 4; ++i)
        {
            m_InputManager.BindButton("ExecuteFunction_" + i, m_KeyCode, InputManager.ButtonState.OnPress);
            m_InputManager.BindButton("ExecuteFunction_" + i, i, m_ControllerButtonCode, InputManager.ButtonState.OnPress);
        }
    }
开发者ID:stijndelaruelle,项目名称:ggj2016,代码行数:11,代码来源:ExecuteFunctionOnButtonPress.cs

示例2: InitInput

        private void InitInput()
        {
            print("Starting Input");
            m_InputManager = InputManager.Instance;

            // initialize button bindings for each button
            for (int i = 0; i < m_playerCount; i++)
            {
                m_InputManager.BindButton("r_p" + i + "A", i, ControllerButtonCode.A, ButtonState.OnPress);
                m_InputManager.BindButton("r_p" + i + "B", i, ControllerButtonCode.B, ButtonState.OnPress);
                m_InputManager.BindButton("r_p" + i + "X", i, ControllerButtonCode.X, ButtonState.OnPress);
                m_InputManager.BindButton("r_p" + i + "Y", i, ControllerButtonCode.Y, ButtonState.OnPress);
                m_InputManager.BindButton("r_p" + i + "Left", i, ControllerButtonCode.Left, ButtonState.OnPress);
                m_InputManager.BindButton("r_p" + i + "Right", i, ControllerButtonCode.Right, ButtonState.OnPress);
                m_InputManager.BindButton("r_p" + i + "Up", i, ControllerButtonCode.Up, ButtonState.OnPress);
                m_InputManager.BindButton("r_p" + i + "Down", i, ControllerButtonCode.Down, ButtonState.OnPress);
            }
        }
开发者ID:stijndelaruelle,项目名称:glupartygame,代码行数:18,代码来源:InputController.cs

示例3: InitializeControls

    private void InitializeControls()
    {
        m_InputManager = InputManager.Instance;

        //Movement

        //PC couldn't handle 4 controllers (super lame, no time)
        if (m_PlayerID == 2)
        {
            m_InputManager.BindAxis("HorizontalAxis_" + m_PlayerID, KeyCode.D, KeyCode.A);
            m_InputManager.BindAxis("VerticalAxis_" + m_PlayerID, KeyCode.W, KeyCode.S);
            m_InputManager.BindButton("Action_" + m_PlayerID, KeyCode.LeftControl, InputManager.ButtonState.OnPress);
        }

        if (m_PlayerID == 3)
        {
            m_InputManager.BindAxis("HorizontalAxis_" + m_PlayerID, KeyCode.RightArrow, KeyCode.LeftArrow);
            m_InputManager.BindAxis("VerticalAxis_" + m_PlayerID, KeyCode.UpArrow, KeyCode.DownArrow);
            m_InputManager.BindButton("Action_" + m_PlayerID, KeyCode.RightControl, InputManager.ButtonState.OnPress);
        }

        m_InputManager.BindAxis("HorizontalAxis_" + m_PlayerID, m_PlayerID, ControllerButtonCode.Right, ControllerButtonCode.Left);
        m_InputManager.BindAxis("HorizontalAxis_" + m_PlayerID, m_PlayerID, ControllerAxisCode.LeftStickX);

        m_InputManager.BindAxis("VerticalAxis_" + m_PlayerID, m_PlayerID, ControllerButtonCode.Up, ControllerButtonCode.Down);
        m_InputManager.BindAxis("VerticalAxis_" + m_PlayerID, m_PlayerID, ControllerAxisCode.LeftStickY);

        //Action
        m_InputManager.BindButton("Action_" + m_PlayerID, m_PlayerID, ControllerButtonCode.A, InputManager.ButtonState.OnPress);
    }
开发者ID:stijndelaruelle,项目名称:ggj2016,代码行数:30,代码来源:Player.cs


注:本文中的InputManager.BindButton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。