Exemple #1
0
        private void JumpStart()
        {
            OneCastingFall_Ray    = false;                              //Reset Values IMPROTANT
            JumpPressedMultiplier = 1;
            IsPersistent          = true;

            JumpSpeed = new MSpeed(animal.CurrentSpeedModifier) //Inherit the Vertical and the Lerps
            {
                name     = "JumpNoRootSpeed",
                position = animal.HorizontalSpeed * activeJump.ForwardMultiplier,
                animator = 1,
                rotation = !animal.UseCameraInput ? AirRotation : 1,
            };


            if (animal.RootMotion)
            {
                JumpSpeed.position = 0;             //Reset it if the Animal is using RootMotion
            }
            animal.SetCustomSpeed(JumpSpeed);       //Set the Current Speed to the Jump Speed Modifier
        }
        public override void AnimationStateEnter()
        {
            if (CurrentAnimTag == AnimTag.FallEdge)
            {
                //   Debug.Log("Enter Fall Edge Animation");
                IgnoreLowerStates = true;
            }
            else if (InMainTagHash)
            {
                //  Debug.Log("Enter Fall");

                UpImpulse = MalbersTools.CleanUpVector(animal.DeltaPos, animal.Forward, animal.Right);   //Clean the Vector from Forward and Horizontal Influence

                IgnoreLowerStates = false;

                FallSpeed = new MSpeed(animal.CurrentSpeedModifier)
                {
                    name     = "FallSpeed",
                    position = animal.HorizontalSpeed,
                    animator = 1,
                    rotation = AirRotation.Value
                };

                if (debug && animal.debugStates)
                {
                    Debug.Log($"Fall Speed: <B>{FallSpeed.position.Value.ToString("F3")}</B>");
                }


                //bool GoingUP = Vector3.Dot(animal.DeltaPos, animal.GravityDirection) < 0; //Check if is falling down
                //if (GoingUP)
                //{
                //    FallCurrentDistance =  -UpImpulse.magnitude/animal.DeltaTime + (animal.GravityForce * animal.GravityMultiplier * animal.DeltaTime);
                //    animal.SetFloatID(FallCurrentDistance);
                //}

                animal.UpdateDirectionSpeed = AirControl;
                animal.SetCustomSpeed(FallSpeed, true);
            }
        }
Exemple #3
0
        public override void EnterCoreAnimation()
        {
            SetStatus(0);
            animal.State_SetFloat(0);

            UpImpulse      = Vector3.Project(animal.DeltaPos, animal.UpVector); //Clean the Vector from Forward and Horizontal Influence
            GoingUPImpulse = Vector3.Dot(UpImpulse, animal.UpVector) > 0;

            if (MTools.CompareOR(animal.LastState.ID, 0, 1, 4, StateEnum.Climb) && GoingUPImpulse || animal.HasExternalForce) //means it was on locomotion or idle //Remove Up Impulse HACK
            {
                UpImpulse = Vector3.zero;
            }


            IgnoreLowerStates = false;

            FallSpeed = new MSpeed(animal.CurrentSpeedModifier)
            {
                name     = "FallSpeed",
                position = animal.HorizontalSpeed + animal.ExternalForceHSpeed,
                animator = 1,
                rotation = AirRotation.Value
            };

            animal.UpdateDirectionSpeed = AirControl; //Set the Directional Speed to be Updated depending the Air Control var IMPORTANT

            if (animal.HasExternalForce)              //???
            {
                animal.DirectionalSpeed = Vector3.ProjectOnPlane(animal.ExternalForce, animal.UpVector).normalized;
            }

            animal.SetCustomSpeed(FallSpeed, true);

            GoingUPImpulse = Vector3.Dot(UpImpulse, animal.UpVector) > 0;

            if (MTools.CompareOR(animal.LastState.ID, 0, 1, 4, StateEnum.Climb) && GoingUPImpulse || animal.HasExternalForce) //means it was on locomotion or idle //Remove Up Impulse HACK
            {
                UpImpulse = Vector3.zero;
            }
        }
Exemple #4
0
        public override void AnimationStateEnter()
        {
            if (InMainTagHash)
            {
                JumpPressHeight_Value = 1;
                JumpSpeed             = new MSpeed(animal.CurrentSpeedModifier) //Inherit the Vertical and the Lerps
                {
                    name         = "Jump Basic Speed",
                    position     = animal.HorizontalSpeed, //Inherit the Horizontal Speed you have from the last state
                    animator     = 1,
                    lerpPosition = AirSmooth,
                    rotation     = AirRotation
                };

                animal.UpdateDirectionSpeed = AirControl;
                if (debug)
                {
                    Debug.Log($" Basic JumpSpeed: {JumpSpeed.position.Value}");
                }
                animal.SetCustomSpeed(JumpSpeed, true);       //Set the Current Speed to the Jump Speed Modifier
            }
        }
Exemple #5
0
        private void JumpStart()
        {
            OneCastingFall_Ray    = false;                              //Reset Values IMPROTANT
            JumpPressedMultiplier = 1;
            //IsPersistent = true;


            var speedMultiplier = Vector3.ProjectOnPlane(animal.DeltaPos, animal.UpVector);

            JumpSpeed = new MSpeed(animal.CurrentSpeedModifier) //Inherit the Vertical and the Lerps
            {
                name     = "JumpNoRootSpeed",
                position = (speedMultiplier / animal.DeltaTime).magnitude * activeJump.ForwardMultiplier / animal.ScaleFactor,
                animator = 1,
                rotation = !animal.UseCameraInput ? AirRotation : 1,
            };

            if (animal.RootMotion)
            {
                JumpSpeed.position = 0;
            }

            animal.SetCustomSpeed(JumpSpeed);       //Set the Current Speed to the Jump Speed Modifier
        }
Exemple #6
0
        public override void AnimationStateEnter()
        {
            if (CurrentAnimTag == AnimTag.FallEdge)
            {
                IgnoreLowerStates = true;
            }
            else if (CurrentAnimTag == MainTagHash)
            {
                UpImpulse = MalbersTools.CleanUpVector(animal.DeltaPos, animal.Forward, animal.Right);   //Clean the Vector from Forward and Horizontal Influence

                IgnoreLowerStates = false;

                FallSpeed = new MSpeed(animal.CurrentSpeedModifier)
                {
                    name     = "FallSpeed",
                    position = animal.HorizontalSpeed,
                    animator = 1,
                    rotation = AirRotation.Value
                };

                animal.UpdateDirectionSpeed = AirControl;
                animal.SetCustomSpeed(FallSpeed, true);
            }
        }