public void UpdateState(ActorLocomotion.AnimationState state)
        {
            if (Mathf.Approximately(Time.get_deltaTime(), 0.0f) || Object.op_Equality((Object)this.Animator, (Object)null) || !((Behaviour)this.Animator).get_isActiveAndEnabled())
            {
                return;
            }
            DefinePack definePack             = Singleton <Resources> .Instance.DefinePack;
            string     directionParameterName = definePack.AnimatorParameter.DirectionParameterName;
            string     forwardMove            = definePack.AnimatorParameter.ForwardMove;
            string     heightParameterName    = definePack.AnimatorParameter.HeightParameterName;
            float      num1 = !state.setMediumOnWalk ? Mathf.InverseLerp(0.0f, state.maxVelocity, (float)state.moveDirection.z) : (state.moveDirection.z <= (double)state.medVelocity || Mathf.Approximately((float)state.moveDirection.z, state.medVelocity) ? Mathf.Lerp(0.0f, 0.5f, Mathf.InverseLerp(0.0f, Mathf.InverseLerp(0.0f, state.maxVelocity, state.medVelocity), Mathf.InverseLerp(0.0f, state.maxVelocity, (float)state.moveDirection.z))) : Mathf.InverseLerp(0.0f, state.maxVelocity, (float)state.moveDirection.z));

            foreach (AnimatorControllerParameter parameter in this.Animator.get_parameters())
            {
                if (!this.Actor.IsSlave && parameter.get_name() == forwardMove && parameter.get_type() == 1)
                {
                    float num2 = Mathf.Lerp(this.Animator.GetFloat(forwardMove), num1, Time.get_deltaTime() * Singleton <Resources> .Instance.LocomotionProfile.LerpSpeed);
                    this.Animator.SetFloat(forwardMove, num2);
                }
                if (parameter.get_name() == heightParameterName && parameter.get_type() == 1)
                {
                    float shapeBodyValue = this.Actor.ChaControl.GetShapeBodyValue(0);
                    this.Animator.SetFloat(heightParameterName, shapeBodyValue);
                }
            }
        }
예제 #2
0
        public void ForceChangeAnime()
        {
            if (!Object.op_Implicit((Object)this.Animator) || !Object.op_Inequality((Object)this.Animator.get_runtimeAnimatorController(), (Object)null))
            {
                return;
            }
            DefinePack definePack = Singleton <Resources> .Instance.DefinePack;

            this.Animator.SetFloat(definePack.AnimatorParameter.ForwardMove, 0.0f);
            this.Animator.Play(definePack.AnimatorState.IdleState, 0, 0.0f);
        }
예제 #3
0
        public void InitializeFaceLight(GameObject root)
        {
            if (Object.op_Inequality((Object)this.FaceLight, (Object)null))
            {
                Object.Destroy((Object)((Component)this.FaceLight).get_gameObject());
            }
            if (!Singleton <Resources> .IsInstance() || Object.op_Equality((Object)root, (Object)null))
            {
                return;
            }
            LocomotionProfile locomotionProfile   = Singleton <Resources> .Instance.LocomotionProfile;
            string            fadeLightParentName = locomotionProfile.FadeLightParentName;

            if (fadeLightParentName.IsNullOrEmpty())
            {
                return;
            }
            GameObject loop = root.get_transform().FindLoop(fadeLightParentName);

            if (Object.op_Equality((Object)loop, (Object)null))
            {
                return;
            }
            DefinePack definePack  = Singleton <Resources> .Instance.DefinePack;
            GameObject gameObject1 = AssetUtility.LoadAsset <GameObject>(definePack.ABPaths.ActorPrefab, "FaceLight", definePack.ABManifests.Default);

            if (Object.op_Equality((Object)gameObject1, (Object)null))
            {
                return;
            }
            GameObject gameObject2 = (GameObject)Object.Instantiate <GameObject>((M0)gameObject1, loop.get_transform(), false);

            if (Object.op_Equality((Object)gameObject2, (Object)null))
            {
                return;
            }
            this.FaceLight = (Light)gameObject2.GetComponent <Light>();
            if (Object.op_Equality((Object)this.FaceLight, (Object)null))
            {
                Object.Destroy((Object)gameObject2);
            }
            else
            {
                ((Component)this.FaceLight).get_transform().set_localRotation(Quaternion.get_identity());
                ((Component)this.FaceLight).get_transform().set_localPosition(locomotionProfile.FaceLightOffset);
                if (!((Behaviour)this.FaceLight).get_enabled())
                {
                    return;
                }
                ((Behaviour)this.FaceLight).set_enabled(false);
            }
        }
예제 #4
0
        public void UpdateState(ActorLocomotion.AnimationState state)
        {
            if (Mathf.Approximately(Time.get_deltaTime(), 0.0f) || Object.op_Equality((Object)this.Animator, (Object)null))
            {
                return;
            }
            AnimatorStateInfo animatorStateInfo = this.Animator.GetCurrentAnimatorStateInfo(0);

            this.IsLocomotionState = ((AnimatorStateInfo) ref animatorStateInfo).IsName("Locomotion");
            DefinePack definePack             = Singleton <Resources> .Instance.DefinePack;
            string     directionParameterName = definePack.AnimatorParameter.DirectionParameterName;
            string     forwardMove            = definePack.AnimatorParameter.ForwardMove;
            string     heightParameterName    = definePack.AnimatorParameter.HeightParameterName;
            float      num1 = !state.setMediumOnWalk ? Mathf.InverseLerp(0.0f, state.maxVelocity, (float)state.moveDirection.z) : (state.moveDirection.z < (double)state.medVelocity || Mathf.Approximately((float)state.moveDirection.z, state.medVelocity) ? Mathf.Lerp(0.0f, 0.5f, Mathf.InverseLerp(0.0f, Mathf.InverseLerp(0.0f, state.maxVelocity, state.medVelocity), Mathf.InverseLerp(0.0f, state.maxVelocity, (float)state.moveDirection.z))) : Mathf.InverseLerp(0.0f, state.maxVelocity, (float)state.moveDirection.z));

            if (!this.Actor.IsSlave)
            {
                float num2 = Mathf.Lerp(this.Animator.GetFloat(forwardMove), num1, Time.get_deltaTime() * Singleton <Resources> .Instance.LocomotionProfile.LerpSpeed);
                this.Animator.SetFloat(forwardMove, num2);
            }
            float shapeBodyValue = this.Actor.ChaControl.GetShapeBodyValue(0);

            this.Animator.SetFloat(heightParameterName, shapeBodyValue);
        }