示例#1
0
    /// <summary>
    /// change animation state
    /// </summary>
    /// <param name="animParam"></param>
    protected override void ChangeAnim(AnimStateBase state)
    {
        List <PlayAnimParam> animParam = ((AnimState)state).playAnimParams;

        string aniTemp = "";

        for (int i = 0; i < animParam.Count; i++)
        {
            PlayAnimParam param = (PlayAnimParam)animParam[i];

            string aniName = param.aniName;

            if (m_anim[aniName] != null)
            {
                m_anim[aniName].wrapMode = param.warpMode;

                if (param.isForcePlay)
                {
                    m_anim.CrossFade(aniName, param.fadeLength);
                }
                else
                {
                    m_anim.CrossFadeQueued(aniName, param.fadeLength);
                }

                aniTemp += "/" + aniName;
            }
        }

        Debug.Log("#Animation# Play Anim : " + aniTemp);
    }
示例#2
0
 private static void ToggleAi(ActorRoot inActor, int inParam)
 {
     if (inActor != null && inActor.ActorAgent != null && inActor.ActorControl != null)
     {
         if (!inActor.ActorAgent.bPaused && !inActor.ActorControl.IsDeadState)
         {
             inActor.ActorControl.CmdStopMove();
             if (inActor.AnimControl != null)
             {
                 PlayAnimParam param = default(PlayAnimParam);
                 param.animName  = "Idle";
                 param.blendTime = 0f;
                 param.loop      = true;
                 param.layer     = 0;
                 param.speed     = 1f;
                 inActor.AnimControl.Play(param);
             }
         }
         inActor.ActorAgent.SetPaused(!inActor.ActorAgent.bPaused);
     }
 }
示例#3
0
 private static void ToggleAi(ActorRoot inActor, int inParam)
 {
     if (((inActor != null) && (inActor.ActorAgent != null)) && (inActor.ActorControl != null))
     {
         if (!inActor.ActorAgent.bPaused && !inActor.ActorControl.IsDeadState)
         {
             inActor.ActorControl.CmdStopMove();
             if (inActor.AnimControl != null)
             {
                 PlayAnimParam param = new PlayAnimParam {
                     animName  = "Idle",
                     blendTime = 0f,
                     loop      = true,
                     layer     = 0,
                     speed     = 1f
                 };
                 inActor.AnimControl.Play(param);
             }
         }
         inActor.ActorAgent.SetPaused(!inActor.ActorAgent.bPaused);
     }
 }
示例#4
0
        public override void Enter(AGE.Action _action, Track _track)
        {
            GameObject gameObject = _action.GetGameObject(this.targetId);

            if ((gameObject != null) && (base.length != 0))
            {
                GameObject actorMesh = gameObject;
                PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);
                if (this.GetAnimation(gameObject) == null)
                {
                    if (actorHandle != 0)
                    {
                        actorMesh = actorHandle.handle.ActorMesh;
                    }
                    else
                    {
                        actorMesh = null;
                    }
                }
                if (actorMesh != null)
                {
                    Animation      animation = this.GetAnimation(actorMesh);
                    AnimationState state     = animation[this.clipName];
                    if (state != null)
                    {
                        if (this.alwaysAnimate && (animation.cullingType != AnimationCullingType.AlwaysAnimate))
                        {
                            animation.cullingType = AnimationCullingType.AlwaysAnimate;
                        }
                        float num = 1f;
                        if (this.startTime < 0f)
                        {
                            this.startTime = 0f;
                        }
                        if (this.endTime > state.clip.length)
                        {
                            this.endTime = state.clip.length;
                        }
                        if (!this.bLoop)
                        {
                            num = ((this.endTime - this.startTime) / base.lengthSec) * (!this.applyActionSpeed ? 1f : _action.playSpeed.single);
                        }
                        else
                        {
                            num = !this.applyActionSpeed ? 1f : _action.playSpeed.single;
                        }
                        AnimPlayComponent animControl = actorHandle.handle.AnimControl;
                        if (animControl != null)
                        {
                            PlayAnimParam param = new PlayAnimParam {
                                animName  = this.clipName,
                                blendTime = this.crossFadeTime,
                                loop      = this.bLoop,
                                layer     = this.layer,
                                speed     = num
                            };
                            animControl.Play(param);
                        }
                        else
                        {
                            if (state.enabled)
                            {
                                animation.Stop();
                            }
                            if (this.crossFadeTime > 0f)
                            {
                                animation.CrossFade(this.clipName, this.crossFadeTime);
                            }
                            else
                            {
                                animation.Play(this.clipName);
                            }
                        }
                        state.speed = num;
                    }
                }
            }
        }
示例#5
0
        public override void Process(Action _action, Track _track)
        {
            GameObject gameObject = _action.GetGameObject(this.targetId);

            if (gameObject != null)
            {
                GameObject actorMesh = gameObject;
                PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);
                if (this.GetAnimation(gameObject) == null)
                {
                    if (actorHandle != 0)
                    {
                        actorMesh = actorHandle.handle.ActorMesh;
                    }
                    else
                    {
                        actorMesh = null;
                    }
                }
                if (actorMesh != null)
                {
                    Animation      animation = this.GetAnimation(actorMesh);
                    AnimationState state     = animation[this.clipName];
                    if (state != null)
                    {
                        if (this.alwaysAnimate && (animation.cullingType != AnimationCullingType.AlwaysAnimate))
                        {
                            animation.cullingType = AnimationCullingType.AlwaysAnimate;
                        }
                        float num = this.playSpeed * (!this.applyActionSpeed ? 1f : _action.playSpeed.single);
                        if (this.bNoTimeScale)
                        {
                            DialogueProcessor.PlayAnimNoTimeScale(animation, this.clipName, this.loop, null);
                        }
                        else
                        {
                            AnimPlayComponent component = (actorHandle == 0) ? null : actorHandle.handle.AnimControl;
                            if (component != null)
                            {
                                PlayAnimParam param = new PlayAnimParam {
                                    animName  = this.clipName,
                                    blendTime = this.crossFadeTime,
                                    loop      = this.loop,
                                    layer     = this.layer,
                                    speed     = num
                                };
                                component.Play(param);
                            }
                            else
                            {
                                if (state.enabled)
                                {
                                    animation.Stop();
                                }
                                if (this.crossFadeTime > 0f)
                                {
                                    animation.CrossFade(this.clipName, this.crossFadeTime);
                                }
                                else
                                {
                                    animation.Play(this.clipName);
                                }
                            }
                        }
                        state.speed = num;
                    }
                }
            }
        }