状态切换测试

#pragma strict
var t:GUIText;
var y:float = 0.1;
function Start () {

}

function Update () {

  if (Input.touchCount > 0) {
    if(Input.GetTouch(0).phase == TouchPhase.Began ){
	     if((Time.time - y) < 0.3){
	     
		       t.text = "gun";
		       animation.CrossFade("Run");
	       
	       }else{
	       
		        t.text = "pao";
		        animation.CrossFade("Walk");
	        }
	       
	     y = Time.time;
     }
  }
}

  

原文地址:https://www.cnblogs.com/softimagewht/p/2623784.html