void UpdateModel() { //model rotation if (radarEnabled) { if (rotationTransform && canScan) { Vector3 direction; if (locked) { direction = Quaternion.AngleAxis(canTrackWhileScan ? currentAngle : lockScanAngle, referenceTransform.up) * referenceTransform.forward; } else { direction = Quaternion.AngleAxis(currentAngle, referenceTransform.up) * referenceTransform.forward; } Vector3 localDirection = Vector3.ProjectOnPlane(rotationTransform.parent.InverseTransformDirection(direction), Vector3.up); if (localDirection != Vector3.zero) { rotationTransform.localRotation = Quaternion.Lerp(rotationTransform.localRotation, Quaternion.LookRotation(localDirection, Vector3.up), 10 * TimeWarp.fixedDeltaTime); } } //lock turret if (lockingTurret && canLock) { if (locked) { lockingTurret.AimToTarget(lockedTarget.predictedPosition, lockingPitch, lockingYaw); } else { lockingTurret.ReturnTurret(); } } } else { if (rotationTransform) { rotationTransform.localRotation = Quaternion.Lerp(rotationTransform.localRotation, Quaternion.identity, 5 * TimeWarp.fixedDeltaTime); } if (lockingTurret) { lockingTurret.ReturnTurret(); } } }
IEnumerator ReturnRoutine() { if (deployed) { hasReturned = false; yield break; } yield return(new WaitForSeconds(0.25f)); while (!turret.ReturnTurret()) { yield return(new WaitForFixedUpdate()); } hasReturned = true; }
IEnumerator ReturnRoutine() { if (turretEnabled) { hasReturned = false; yield break; } yield return(new WaitForSeconds(0.25f)); while (pausingAfterShot) { yield return(new WaitForFixedUpdate()); } while (turret != null && !turret.ReturnTurret()) { UpdateMissilePositions(); yield return(new WaitForFixedUpdate()); } }