EasyTouch5.0.17

目录

(一)EasyTouch基础使用 

1.OnTouchStart,OnTouchUp,OnSwipe

2.QuickGesture

(1)Quick Drag

(2)Quick Enter Over Exit

(3)Quick Long Tap 

(4)Quick Pinch(按住alt,可以模拟双指)

(5)Quick Swipe

(6)Quick Tap

(7) Quick Touch

(8)Quick Twist

(二)EasyTouch JoyStick


(一)EasyTouch基础使用 

1.OnTouchStart,OnTouchUp,OnSwipe

 

using UnityEngine;
using HedgehogTeam.EasyTouch;
public class Test : MonoBehaviour 
{
    
    private void Update()
    {
        Gesture currentGesture = EasyTouch.current;
        if (currentGesture != null&&currentGesture.type ==EasyTouch .EvtType .On_TouchStart )
        {
            OnTouchStart(currentGesture);
        }
        if(currentGesture != null && currentGesture .type ==EasyTouch .EvtType .On_TouchUp)
        {
            OnTouchUp(currentGesture);
        }
        if(currentGesture != null && currentGesture .type ==EasyTouch .EvtType .On_Swipe)
        {
            OnSwipe(currentGesture);
        }
    }
    void OnTouchStart(Gesture gesture)
    {
        Debug.Log("OnTouchStart! StartPosition:" + gesture.startPosition);
    }
    void OnTouchUp(Gesture gesture)
    {
        Debug.Log("OnTouchUp! ActionTime:" + gesture.actionTime);
    }
    void OnSwipe(Gesture gesture)
    {
        Debug.Log("OnSwipe! Type:" + gesture.swipe );
    }
}

2.QuickGesture

先给cube添加脚本“QuickGestureDemo”

using UnityEngine;

public class QuickGestureDemo : MonoBehaviour 
{
    public void PrintNum(int num)
    {
        Debug.Log(num);
    }
}

(1)Quick Drag

(2)Quick Enter Over Exit

(3)Quick Long Tap 

(4)Quick Pinch(按住alt,可以模拟双指)

(5)Quick Swipe

(6)Quick Tap

(7) Quick Touch

(8)Quick Twist

(二)EasyTouch JoyStick

      

 

using UnityEngine;

public class EasyTouchTest : MonoBehaviour 
{
    public   float speed = 1;

    public void CubeTranslate(Vector2 direction)
    {
        transform.Translate(new Vector3(direction.x * Time.deltaTime * speed, 0, direction.y  * Time.deltaTime * speed));
    }

    public void Fire()
    {
        Debug.Log("fire");
    }
    public void FireAlways()
    {
        Debug.Log("FireAlways");
    }
    public void CloseWnd()
    {
        Debug.Log("CloseWnd");
    }
}

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值