private bool TryRotateUsingStarter(GameObject shipBase) { float rotationFix = TryGetRotationFixFinisher(shipBase); bool result = false; if (!float.IsNaN(rotationFix)) { result = true; float angleFix = GetAngleFixRotation(shipBase); float savedRotation = TheShip.GetModelOrientation().transform.localEulerAngles.y; TheShip.SetRotationHelper2Angles(new Vector3(0, rotationFix, 0)); TheShip.UpdateRotationHelperAngles(new Vector3(0, angleFix, 0)); if (GetPathToProcessLeft(shipBase) <= 0) { result = false; TheShip.SetRotationHelper2Angles(new Vector3(0, savedRotation, 0)); TheShip.UpdateRotationHelperAngles(new Vector3(0, -angleFix, 0)); } } return(result); }
// ROTATION public void UpdateRotation() { if (GetPathToProcessLeft(TheShip.GetModelOrientation()) > 0) { float rotationFix = GetRotationFix(TheShip.GetModelOrientation()); TheShip.SetRotationHelper2Angles(new Vector3(0, rotationFix, 0)); float angleFix = GetAngleFix(TheShip.GetModelOrientation()); TheShip.UpdateRotationHelperAngles(new Vector3(0, angleFix, 0)); } AddMovementTemplateCenterPoint(TheShip.Model); }