Esempio n. 1
0
 public void ResetAnimateVariable(string actionName, bool active)
 {
     this.curActionName = actionName;
     this.curAnimation  = anim.getMeshAnimation(curActionName);
     if (this.curAnimation == null)
     {
         this.delay  = 0.1f;
         this.isLoop = true;
         this.curAnimationFrameNum = 1;
     }
     else
     {
         this.delay  = curAnimation.delay;
         this.isLoop = curAnimation.loop;
         this.curAnimationFrameNum = curAnimation.frameList.Count;
     }
     this.curTime  = 0;
     this.FrameNum = 0;
     this.active   = active;
 }
Esempio n. 2
0
    /// <summary>
    /// 开始动画
    /// </summary>
    /// <param name="actionName">动作名</param>
    /// <param name="animTime">动画播放时间</param>
    public void startAnimate(string actionName, float animTime = 0)
    {
        MeshAnimation temp = anim.getMeshAnimation(actionName);

        if (temp == null)
        {
            stopAnimate();
            return;
        }
        this.curActionName = actionName;
        this.curAnimation  = temp;
        this.maxFrameNum   = curAnimation.frameList.Count;
        Debug.Log("maxFrameNum = " + this.maxFrameNum);
        float frameDelta = animTime / this.maxFrameNum;

        this.delay    = (frameDelta > 0) ? frameDelta : curAnimation.delay;
        this.isLoop   = curAnimation.loop;
        this.curTime  = 0;
        this.FrameNum = 0;
        this.active   = true;
    }