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;
            }
  • 相关阅读:
    脏数据
    LeetCode之Sort List
    COCOS2D-X FRAME动画创作随笔
    基于OpenCV性别识别
    Twitter 新一代流处理工具——Heron 该纸币Storm Limitations
    oracle设备
    苏州面对公司发布
    Weblogic监控指标
    mysql TIME_WAIT
    weblogic监控
  • 原文地址:https://www.cnblogs.com/Study088/p/9568085.html
Copyright © 2011-2022 走看看