c# - 在屏幕上滑动以在游戏中滑动
问题描述
我如何检测玩家何时向下滑动屏幕并让他滑动?我试图做这样的事情:
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
startTouchPosition = Input.GetTouch(0).position;
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
{
endTouchPosition = Input.GetTouch(0).position;
if (endTouchPosition.y < startTouchPosition.y)
preformSlide();
Invoke("StopSlide", 1);
}
解决方案
推荐阅读
- mysql - 如何使用nodejs将文件路径插入mysql表
- json - 在 ResponseBodyAdvice 的 Spring 实现中了解预期的 RestController
- c# - c# property Setter 不适用于我的组件
- entity-framework - 如何使用 Azure AD / OpenId 进行身份验证,但使用基于实体框架的用户/角色数据
- matlab - 如何找到矩阵中的重复值以及它们属于哪些行?
- jmeter - 如何使用 JMeter 在文件中写入 HTML 响应
- javascript - 无法从 JSON 中读取未定义的属性“customer_name”
- angular - 如何使用任何 Angular cli 版本创建特定版本的 Angular 项目?
- android - 谷歌服务插件和数据绑定问题
- android - 读取 JSON 嵌套数组响应以避免 android 中的重复条目