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


C# InputDevice.Vibrate方法代码示例

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


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

示例1: buttonClicked

    // Map controllers to players
    void buttonClicked(InputDevice player,int playerIndex)
    {
        player.Vibrate(.2f, .2f);
        StartCoroutine("vibrateControllerStop", player);
        if (player.Action2.WasPressed)
        {
            buttonList[0].GetComponent<Image>().color = new Color32(50, 50, 50, 255);
            buttonList[0].GetComponentInChildren<Text>().enabled = false;
            buttonsSet[0] = true;
            Main.S.carTop.GetComponent<ArcadeVehicle>().first = playerIndex;
        }
        else if (player.Action1.WasPressed)
        {
            buttonList[1].GetComponent<Image>().color = new Color32(50, 50, 50, 255);
            buttonList[1].GetComponentInChildren<Text>().enabled = false;
            buttonsSet[1] = true;
            Main.S.carTop.GetComponent<ArcadeVehicle>().second = playerIndex;
        }
        else if (player.Action4.WasPressed)
        {
            buttonList[2].GetComponent<Image>().color = new Color32(50, 50, 50, 255);
            buttonList[2].GetComponentInChildren<Text>().enabled = false;
            buttonsSet[2] = true;
            Main.S.carBottom.GetComponent<ArcadeVehicle>().first = playerIndex;
        }
        else if (player.Action3.WasPressed)
        {
            buttonList[3].GetComponent<Image>().color = new Color32(50, 50, 50, 255);
            buttonList[3].GetComponentInChildren<Text>().enabled = false;
            buttonsSet[3] = true;
            Main.S.carBottom.GetComponent<ArcadeVehicle>().second = playerIndex;
        }

        countSet++;
        // If all connected devices have chosen a team prompt for start of game
        if (countSet == InputManager.Devices.Count)
        {
            text.GetComponent<Text>().text = "Press Any Button To Continue";
            for (int i = 0; i < buttonsSet.Count; i++)
            {
                if (buttonsSet[i] == false)
                {
                    if (i == 0 && buttonsSet[i + 1] == true)
                    {
                        Main.S.carTop.GetComponent<ArcadeVehicle>().first = Main.S.carTop.GetComponent<ArcadeVehicle>().second;
                    }
                    else if (i == 1 && buttonsSet[i - 1] == true)
                    {
                        Main.S.carTop.GetComponent<ArcadeVehicle>().second = Main.S.carTop.GetComponent<ArcadeVehicle>().first;
                    }
                    else if (i == 2 && buttonsSet[i + 1] == true)
                    {
                        Main.S.carBottom.GetComponent<ArcadeVehicle>().first = Main.S.carBottom.GetComponent<ArcadeVehicle>().second;
                    }
                    else if (i == 3 && buttonsSet[i - 1] == true)
                    {
                        Main.S.carBottom.GetComponent<ArcadeVehicle>().second = Main.S.carBottom.GetComponent<ArcadeVehicle>().first;
                    }
                }
            }
            cooldown = Time.realtimeSinceStartup;
        }
    }
开发者ID:avimatt,项目名称:Carmony,代码行数:64,代码来源:StartScreen.cs

示例2: vibrateControllerStop

 IEnumerator vibrateControllerStop(InputDevice player)
 {
     float pauseEndTime = Time.realtimeSinceStartup + .2f;
     while (Time.realtimeSinceStartup < pauseEndTime)
     {
         yield return 0;
     }
     player.Vibrate(0, 0);
 }
开发者ID:avimatt,项目名称:Carmony,代码行数:9,代码来源:StartScreen.cs


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