touch触摸滑屏
来源:互联网 发布:mac怎样删除文件 编辑:程序博客网 时间:2024/05/18 02:08
using UnityEngine;
using System.Collections;
public class UIMove2 : MonoBehaviour {
public Vector2 startPosition = Vector2.zero;
public static int count; //定义touchCount数
public GameObject a;
public GameObject b;
public GameObject c;
public float scrollVelocity = 0f;
public float timeTouchPhaseEnded = 0f;
public Vector2 touchposition; //存储移动三维坐标值
float aa;
void Start(){
aa = transform.localPosition.y;
}
void Update () {
if(Input.touchCount>0)
{
if(Input.GetTouch(0).phase==TouchPhase.Moved) //[color=Red]如果点击手指touch了 并且手指touch的状态为移动的[/color]
{
b.GetComponent<CameraMove>().enabled=false;
startPosition.y+=Input.GetTouch(0).deltaPosition.y;
touchposition=Input.GetTouch(0).deltaPosition;
a.transform.Translate(0f,touchposition.y*0.01f,0f);//[color=Red]移动这个距离[/color]
if(aa<transform.localPosition.y&&transform.localPosition.y>-100){
transform.localPosition = new Vector2(touchposition.x,touchposition.y=-100);
c.GetComponent<TweenPosition>().enabled=false;
}
if(aa>transform.localPosition.y&&transform.localPosition.y<-800){
c.GetComponent<TweenPosition>().enabled=true;
}
b.GetComponent<CameraMove>().enabled=true;
aa=transform.localPosition.y;
}
timeTouchPhaseEnded = Time.time;
}
}
}
原谅代码没那么严谨,,会改的
- touch触摸滑屏
- 触摸(Touch)
- 触摸touch
- touch手势与触摸
- 多点触摸multi-touch
- Android Touch 触摸事件
- UIScrollView touch 触摸事件
- 触摸模式(Touch Mode)
- js 触摸事件 touch
- 【Touch】触摸事件onTouch
- touch触摸事件
- Android 多点触摸 multi-touch
- Windows Touch 触摸板编程
- Android 多点触摸 multi-touch
- quick-lua touch 触摸事件
- js多点触摸touch事件
- Android Touch 手势触摸原理
- 触摸事件 Touch MotionEvent ACTION
- linux 消息队列实例
- 根据指定时间获取时间
- 经典的面试问答(转自黑马培训营论坛)
- Patch文件的创建和使用
- HDOJ 5252 追星族
- touch触摸滑屏
- 西楚战队强势出手控股韩国知名品牌“蜜都”
- Android点击EditText文本框之外任何地方隐藏键盘的解决办法
- JAVA -- 关键字 abstract、static、final、native、synchronized
- iOS KVC和KVO
- 使用PowerDesigner画图教程
- MySQL之——优化篇
- Android开源项目分类汇总
- js遍历对象的属性并且动态添加属性并提交表单