// MOVEMENT EXECUTION public override void UpdateMovementExecution() { float progressDelta = AnimationSpeed * Time.deltaTime; progressDelta = Mathf.Clamp(progressDelta, 0, Mathf.Abs(ProgressTarget - ProgressCurrent)); ProgressCurrent += progressDelta; if (!movementFinisherLaunched) { float turningDirection = (Direction == ManeuverDirection.Right) ? 1 : -1; int progressDirection = 1; TheShip.RotateAround(TheShip.TransformPoint(new Vector3(turningAroundDistance * turningDirection, 0, 0)), turningDirection * progressDelta * progressDirection); if (ProgressTarget != 0) { TheShip.RotateModelDuringTurn((ProgressCurrent / ProgressTarget) * (1 - 0.2f * finisherTargetSuccess)); } UpdateRotation(); } else { Vector3 progressDirection = Vector3.forward; TheShip.SetPosition(Vector3.MoveTowards(TheShip.GetPosition(), TheShip.GetPosition() + TheShip.TransformDirection(progressDirection), progressDelta)); if (finisherTargetSuccess != 0) { TheShip.RotateModelDuringTurn((1 - 0.2f * finisherTargetSuccess) + (ProgressCurrent / ProgressTarget) * 0.2f); } UpdateRotationFinisher(); } base.UpdateMovementExecution(); }
public override void UpdateMovementExecution() { float progressDelta = AnimationSpeed * Time.deltaTime; progressDelta = Mathf.Clamp(progressDelta, 0, Mathf.Abs(ProgressTarget - ProgressCurrent)); ProgressCurrent += progressDelta; TheShip.SetPosition(Vector3.MoveTowards(TheShip.GetPosition(), TheShip.GetPosition() + TheShip.TransformDirection(Vector3.forward), progressDelta)); base.UpdateMovementExecution(); }
private void DoBarrelRollAnimation() { float progressStep = 2.5f * Time.deltaTime * Options.AnimationSpeed; progressStep = Mathf.Min(progressStep, progressTarget - progressCurrent); progressCurrent += progressStep; TheShip.SetPosition(Vector3.MoveTowards(TheShip.GetPosition(), TemporaryShipBase.transform.position, progressStep)); TheShip.RotateModelDuringBarrelRoll(progressCurrent / progressTarget, HelperDirection); TheShip.SetRotationHelper2Angles(new Vector3(0, progressCurrent / progressTarget * (plannedRotation - initialRotation), 0)); TheShip.MoveUpwards(progressCurrent / progressTarget); if (progressCurrent >= progressTarget) { performingAnimation = false; GameMode.CurrentGameMode.FinishBarrelRoll(); } }
private void DoBarrelRollAnimation() { float progressStep = Time.deltaTime * 0.2f * (0.5f + Options.AnimationSpeed * 10f); progressStep = Mathf.Min(progressStep, progressTarget - progressCurrent); progressCurrent += progressStep; TheShip.SetPosition(Vector3.MoveTowards(TheShip.GetPosition(), TemporaryShipBase.transform.position, progressStep)); if (!IsTractorBeamBarrelRoll && !TheShip.IsLandedModel) { TheShip.RotateModelDuringBarrelRoll(progressCurrent / progressTarget, (Direction == Direction.Left) ? -1 : 1); TheShip.SetRotationHelper2Angles(new Vector3(0, progressCurrent / progressTarget * (plannedRotation - initialRotation), 0)); TheShip.MoveUpwards(progressCurrent / progressTarget); } if (progressCurrent >= progressTarget) { performingAnimation = false; FinishReposition(); } }