zoukankan      html  css  js  c++  java
  • unity中手机触摸代码

    #elif UNITY_IOS || UNITY_ANDROID
            if(Input.touchCount <= 0)
            {
                return;//强制退出  不执行以下有关触摸的代码
            }
            if (Input.GetTouch(0).phase == TouchPhase.Began)
            {
                previousPositionX = Input.GetTouch(0).position.x;


                startAddSpeed = false;
                startAddSpeed_reduce = false;
                startReduceSpeed = false;
                ShowSpeed = 15f;
            }
            if (Input.GetTouch(0).phase == TouchPhase.Moved)
            {
                offset = Input.GetTouch(0).position.x - previousPositionX;
                if (Input.GetTouch(0).deltaPosition.x > 0)
                {
                    ShowSpeed = 55f;
                }
                else if (Input.GetTouch(0).deltaPosition.x < 0)
                {
                    ShowSpeed = -30f;
                }
                previousPositionX = Input.GetTouch(0).position.x;
            }
            if (Input.GetTouch(0).phase == TouchPhase.Ended)
            {
                if (ShowSpeed < 15)
                {
                    startAddSpeed = true;
                    startAddSpeed_reduce = true;
                }
                else if (ShowSpeed > 15)
                {
                    startReduceSpeed = true;
                }
                mouseCurrentPos = Input.GetTouch(0).position;
                mouseIsMove = false;
            }
  • 相关阅读:
    Spring和SpringMVC的关系
    The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory的解决方法
    java面试题
    单例模式
    java中的继承关系
    java重载
    JSP页面读取数据中的数据内容,出现乱码现象的解决方法
    java中时间与时间戳的相互转换
    java中重写
    eclipse中经常用到的修改菜单项
  • 原文地址:https://www.cnblogs.com/Study088/p/9568085.html
Copyright © 2011-2022 走看看