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;
            }
  • 相关阅读:
    绳关节(b2RopeJoint)
    公式推导 圆面积公式 圆周长公式
    ALTER TABLE causes auto_increment resulting key 'PRIMARY'
    MySQL通过Binlog恢复删除的表
    Barracuda VS antelope
    mysqldump 参数说明
    MySQL复制
    MySQL Server-id的作用
    MySQL 简洁连接数据库方式
    Kill 所有MySQL进程
  • 原文地址:https://www.cnblogs.com/Study088/p/9568085.html
Copyright © 2011-2022 走看看