Example #1
0
        private void PauseAnimation()
        {
            AnimPlayComponent animControl = this.actorObj.handle.AnimControl;

            if (animControl != null)
            {
                this.curAnimName = animControl.GetCurAnimName();
                if ((this.actorObj.handle.ActorMesh != null) && (this.actorObj.handle.ActorMeshAnimation != null))
                {
                    AnimationState state = this.actorObj.handle.ActorMeshAnimation[this.curAnimName];
                    if (state != null)
                    {
                        state.speed = 0f;
                    }
                    animControl.bPausePlay = true;
                }
            }
        }
Example #2
0
        private void RecoverAnimation()
        {
            AnimPlayComponent animControl = this.actorObj.handle.AnimControl;

            if ((this.actorObj.handle.ActorMesh != null) && (this.actorObj.handle.ActorMeshAnimation != null))
            {
                AnimationState state = this.actorObj.handle.ActorMeshAnimation[this.curAnimName];
                if (state != null)
                {
                    state.speed = 1f;
                }
                if (animControl != null)
                {
                    animControl.bPausePlay = false;
                    animControl.UpdatePlay();
                }
            }
        }
Example #3
0
        private void RecoverAnimation()
        {
            AnimPlayComponent animControl = this.actorObj.handle.AnimControl;

            if (this.actorObj.handle.ActorMesh == null || this.actorObj.handle.ActorMeshAnimation == null)
            {
                return;
            }
            AnimationState animationState = this.actorObj.handle.ActorMeshAnimation[this.curAnimName];

            if (animationState != null)
            {
                animationState.speed = this.recordSpeed;
            }
            if (animControl != null)
            {
                animControl.bPausePlay = false;
                animControl.UpdatePlay();
            }
        }
Example #4
0
        private void PauseAnimation()
        {
            AnimPlayComponent animControl = this.actorObj.get_handle().AnimControl;

            if (animControl == null)
            {
                return;
            }
            this.curAnimName = animControl.GetCurAnimName();
            if (this.actorObj.get_handle().ActorMesh == null || this.actorObj.get_handle().ActorMeshAnimation == null)
            {
                return;
            }
            AnimationState animationState = this.actorObj.get_handle().ActorMeshAnimation[this.curAnimName];

            if (animationState != null)
            {
                animationState.speed = 0f;
            }
            animControl.bPausePlay = true;
        }
Example #5
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;
                    }
                }
            }
        }
        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;
                    }
                }
            }
        }
        public override void Process(Action _action, Track _track)
        {
            GameObject gameObject = _action.GetGameObject(this.targetId);

            if (gameObject == null)
            {
                return;
            }
            GameObject gameObject2 = gameObject;
            PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);

            if (this.GetAnimation(gameObject) == null)
            {
                if (actorHandle)
                {
                    gameObject2 = actorHandle.get_handle().ActorMesh;
                }
                else
                {
                    gameObject2 = null;
                }
            }
            if (gameObject2 == null)
            {
                return;
            }
            Animation      animation      = this.GetAnimation(gameObject2);
            AnimationState animationState = animation[this.clipName];

            if (animationState == null)
            {
                return;
            }
            if (this.alwaysAnimate && animation.cullingType != AnimationCullingType.AlwaysAnimate)
            {
                animation.cullingType = AnimationCullingType.AlwaysAnimate;
            }
            float speed = this.playSpeed * ((!this.applyActionSpeed) ? 1f : _action.playSpeed.get_single());

            if (this.bNoTimeScale)
            {
                DialogueProcessor.PlayAnimNoTimeScale(animation, this.clipName, this.loop, null);
            }
            else
            {
                AnimPlayComponent animPlayComponent = (!actorHandle) ? null : actorHandle.get_handle().AnimControl;
                if (animPlayComponent != null)
                {
                    animPlayComponent.Play(new PlayAnimParam
                    {
                        animName  = this.clipName,
                        blendTime = this.crossFadeTime,
                        loop      = this.loop,
                        layer     = this.layer,
                        speed     = speed
                    });
                }
                else
                {
                    if (animationState.enabled)
                    {
                        animation.Stop();
                    }
                    if (this.crossFadeTime > 0f)
                    {
                        animation.CrossFade(this.clipName, this.crossFadeTime);
                    }
                    else
                    {
                        animation.Play(this.clipName);
                    }
                }
            }
            animationState.speed = speed;
        }
Example #8
0
        public override void Enter(Action _action, Track _track)
        {
            GameObject gameObject = _action.GetGameObject(this.targetId);

            if (gameObject == null || this.length == 0)
            {
                return;
            }
            PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);
            Animation animation;

            if (actorHandle)
            {
                animation = actorHandle.get_handle().ActorMeshAnimation;
            }
            else
            {
                GameObject obj = gameObject;
                animation = this.GetAnimation(obj);
            }
            if (animation == null)
            {
                return;
            }
            AnimationState animationState = animation[this.clipName];

            if (animationState == null)
            {
                return;
            }
            if (this.alwaysAnimate && animation.cullingType != AnimationCullingType.AlwaysAnimate)
            {
                animation.cullingType = AnimationCullingType.AlwaysAnimate;
            }
            if (this.startTime < 0f)
            {
                this.startTime = 0f;
            }
            if (this.endTime > animationState.clip.length)
            {
                this.endTime = animationState.clip.length;
            }
            float speed;

            if (!this.bLoop)
            {
                speed = (this.endTime - this.startTime) / base.lengthSec * ((!this.applyActionSpeed) ? 1f : _action.playSpeed.get_single());
            }
            else
            {
                speed = ((!this.applyActionSpeed) ? 1f : _action.playSpeed.get_single());
            }
            AnimPlayComponent animControl = actorHandle.get_handle().AnimControl;

            if (animControl != null)
            {
                animControl.Play(new PlayAnimParam
                {
                    animName  = this.clipName,
                    blendTime = this.crossFadeTime,
                    loop      = this.bLoop,
                    layer     = this.layer,
                    speed     = speed
                });
            }
            else
            {
                if (animationState.enabled)
                {
                    animation.Stop();
                }
                if (this.crossFadeTime > 0f)
                {
                    animation.CrossFade(this.clipName, this.crossFadeTime);
                }
                else
                {
                    animation.Play(this.clipName);
                }
            }
            animationState.speed = speed;
        }