var minimumRunSpeed = 1.0; //跑步最小速度
function Start () {
// Set all animations to loop
animation.wrapMode = WrapMode.Loop; //播发模型为循环播放
// Except our action animations, Dont loop those
animation["shoot"].wrapMode = WrapMode.Once; //射击的动画播放模式是只播放一次
// Put idle and run in a lower layer. They will only animate if our action animations are not playing
animation["idle"].layer = -1; //层为-1
animation["walk"].layer = -1; //层为-1
animation["run"].layer = -1; //层为-1
animation.Stop(); //动画停止
}
function SetSpeed (speed : float) { //设置速度
if (speed > minimumRunSpeed) //速度大于跑步的最小速度
animation.CrossFade("run"); //为跑的动作
else
animation.CrossFade("idle"); //为空闲的动作
}