【发布时间】:2021-02-18 13:59:42
【问题描述】:
我为 android 制作游戏,我需要在游戏屏幕上有 UI 操纵杆和 UI 攻击按钮。我已经有可用的操纵杆和键盘空格键上的攻击按钮。 有人能告诉我如何将代码从键盘输入切换到触摸输入吗? 附言对不起我的英语。
if (Time.time >= nextAttackTime)
{
if (Input.GetKeyDown(KeyCode.Space))
{
Attack();
nextAttackTime = Time.time + 2.5f / attackRate;
}
}
【问题讨论】: