您的位置:首页 > 移动开发 > Unity3D

Unity之快捷键组合

2016-06-12 00:51 363 查看
#region 快捷键

bool isDown = false;
KeyCode currentKey;
void Update()
{
// 普通奖
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad0))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 0 普通奖");
}

//幸运送次数 幸运座位,在正常中奖的前提下,多送1--11个动物 (恭喜发财)
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad1))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 1 幸运送次数");
}

//送颜色(同颜色中奖)
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad2))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 2 送颜色");
}
//送动物(同动物中奖)
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad3))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 3 送动物");
}
//送彩金
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad4))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 4 送彩金");
}
//幸运彩金
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad5))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 5 幸运彩金");
}

//幸运送颜色
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad6))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 6 幸运送颜色");
}
//幸运送动物
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad7))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 7 幸运送动物");
}
//幸运大满贯
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad8))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 8 幸运大满贯");
}

//棒棒糖(送灯)
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKey(KeyCode.Keypad9))
{
if (isDown)
return;
isDown = true;
Debug.LogError("CTRL + 9 棒棒糖(送灯)");
}

//超级大乐透
if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKey(KeyCode.Keypad0))
{
if (isDown)
return;
isDown = true;
Debug.LogError("ALt + 0 棒棒糖(送灯)");
}

//抬起键
if (Input.GetKeyUp(KeyCode.LeftControl) || Input.GetKeyUp(KeyCode.RightControl) || Input.GetKeyUp(KeyCode.LeftAlt)) {
isDown = false;
Debug.LogError("抬起");
}

}
#endregion
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息