public override UnitState FixedUpdate() { var globalLookDirection = Parameters.LookLogicDirection; var moveScaledLogicDirection = Parameters.MoveScaledLogicDirection; var parametersAngle = AngleCalculator.CalculateLogicAngle(moveScaledLogicDirection, globalLookDirection); var logicLookDirection = GetLogicVector(globalLookDirection); if (Mathf.Abs(parametersAngle) <= 120) { ManageReachingLegsTurnDirection(logicLookDirection, moveScaledLogicDirection.normalized); } else { ManageReachingLegsTurnDirection(logicLookDirection, -moveScaledLogicDirection.normalized); } Torso.TurnTowards(logicLookDirection); Torso.AimAt(Parameters.AimAtDirection); Legs.Move(moveScaledLogicDirection); Legs.StraightenUp(); Torso.Move(moveScaledLogicDirection); Torso.StraightenUp(); return this; }
void DelegateMovement() { legs.Move(keyPresses); legs.Jump(jumpPressed); }