aa

using UnityEngine;
using System.Collections;

public class FaceTouch : MonoBehaviour {
    float _time = 0f;
    int _num = 0;
    bool _isplay;
    // Use this for initialization
    void OnEnable()
    {
        EasyTouch.On_SimpleTap += On_SimpleTap;
        EasyTouch.On_TouchUp += On_TouchUp;
        EasyTouch.On_Drag += On_Drag;
        EasyTouch.On_DragStart += On_DragStart;
        EasyTouch.On_DragEnd += On_DragEnd;
    }
    void OnDisable()
    {
        UnsubscribeEvent();
    }
    void OnDestroy()
    {
        UnsubscribeEvent();
    }
    void UnsubscribeEvent()
    {
        EasyTouch.On_TouchUp -= On_TouchUp;
        EasyTouch.On_SimpleTap -= On_SimpleTap;
        EasyTouch.On_Drag -= On_Drag;
        EasyTouch.On_DragStart -= On_DragStart;
        EasyTouch.On_DragEnd -= On_DragEnd;
    }
    void On_SimpleTap(Gesture gesture) {
        if (gesture.pickObject != gameObject)
        {
            return;
        }
        Debug.Log("On_SimpleTap");
        _isplay = true;
        _time++; ;
        Debug.Log("_" + _time);
        StartCoroutine("onStart");
    }
    void On_TouchUp(Gesture gesture)
    {
        if (gesture.pickObject != gameObject)
        {
            return;
        }
        Debug.Log("On_TouchUp");
    }
    void On_DragStart(Gesture gesture)
    {
        if (gesture.pickObject != gameObject)
        {
            return;
        }
        MainAnimCtr._STATE = MainAnimCtr.STATE.STATE_LIAN_A;
        Debug.Log("On_DragStart");
    }
    void On_Drag(Gesture gesture)
    {
        if (gesture.pickObject != gameObject)
        {
            return;
        }
        Debug.Log("On_Drag");
        MainAnimCtr._STATE = MainAnimCtr.STATE.STATE_LIAN_A;
        MainAnimCtr._animState = 11;
    }
    void On_DragEnd(Gesture gesture)
    {
        if (gesture.pickObject != gameObject)
        {
            return;
        }
        Debug.Log("On_DragEnd");
        MainAnimCtr._animState = 112;
    }
    void FixedUpdate() {
        if (_isplay)
        {
            _time -= Time.deltaTime;
            
            Debug.Log("--- " + _time);
        }
    }
    IEnumerator onStart()
    {
        yield return new WaitForSeconds(1f);
        _isplay = false;
        //MainAnimCtr._STATE = MainAnimCtr.STATE.STATE_LIAN_A;
        if (_time < 0)
        {
            Debug.Log("S " + _time);
            
           // MainAnimCtr._animState = 12;
        }
        else {
            Debug.Log("D " + _time);
            //MainAnimCtr._animState = 13;
        }
        _time = 0;
    }
}

 

posted @ 2013-12-14 18:06  古刹红罗  阅读(274)  评论(0)    收藏  举报