void FixedUpdate() { // Check if on a solid surface grounded = (collisionFlags & CollisionFlags.Below) != 0; // Clear movement if (cancelMovement) { moveDirection = Vector3.zero; cancelMovement = false; groundMotor.ClearActivePlatform(); acrobatMotor.ClearFallingDamage(); return; } // Handle freeze movement if (freezeMotor > 0) { freezeMotor -= Time.deltaTime; if (freezeMotor <= 0) { freezeMotor = 0; CancelMovement = true; } return; } playerScanner.FindHeadHit(new Ray(controller.transform.position, Vector3.up)); playerScanner.SetHitSomethingInFront(); // Check if should hang hangingMotor.HangingChecks(); // Handle Rappeling rappelMotor.RappelChecks(); // Handle climbing climbingMotor.ClimbingCheck(); // Do nothing if player levitating/swimming or climbing - replacement motor will take over movement for levitating/swimming if (levitateMotor && (levitateMotor.IsLevitating || levitateMotor.IsSwimming) || climbingMotor.IsClimbing || hangingMotor.IsHanging) { moveDirection = Vector3.zero; return; } if (climbingMotor.WallEject) { // True in terms of the player having their feet on solid surface. grounded = true; } if (grounded) { acrobatMotor.Jumping = false; acrobatMotor.CheckFallingDamage(); // checks if sliding and applies movement to moveDirection if true frictionMotor.GroundedMovement(ref moveDirection); acrobatMotor.HandleJumpInput(ref moveDirection); } else { acrobatMotor.CheckInitFall(ref moveDirection); acrobatMotor.CheckAirControl(ref moveDirection, speed); } playerScanner.FindStep(moveDirection); acrobatMotor.ApplyGravity(ref moveDirection); acrobatMotor.HitHead(ref moveDirection); groundMotor.MoveWithMovingPlatform(moveDirection); }