예제 #1
0
파일: Moving.cs 프로젝트: witia87/Overhaul
        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;
        }
예제 #2
0
 void DelegateMovement()
 {
     legs.Move(keyPresses);
     legs.Jump(jumpPressed);
 }