public void PerformReturnObject(OnPerformEnd onPerformReturned) { if (!ClosedUpObject) { return; } StartCoroutine(PerformReturnObject(onPerformReturned, 1.0f)); }
IEnumerator PerformCloseUp(Transform objectToClose, OnPerformEnd onPerformClosedUp, float time) { for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / time) { objectToClose.position = Vector3.Lerp(objectToClose.position, ObjectCloseUpPosition, t); objectToClose.rotation = Quaternion.Lerp(objectToClose.rotation, objectToCloseTo.rotation, t); yield return(null); } onPerformClosedUp?.Invoke(); }
IEnumerator PerformReturnObject(OnPerformEnd onPerformReturned, float time) { for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / time) { ClosedUpObject.position = Vector3.Lerp(ClosedUpObject.position, _originalObjectPosition, t); ClosedUpObject.rotation = Quaternion.Lerp(ClosedUpObject.rotation, _originalObjectRotation, t); yield return(null); } ClosedUpObject = null; onPerformReturned?.Invoke(); }
public void PerformCloseUp(Transform objectToClose, OnPerformEnd onPerformClosedUp) { if (ClosedUpObject == objectToClose) { return; } ClosedUpObject = objectToClose; _originalObjectPosition = ClosedUpObject.position; _originalObjectRotation = ClosedUpObject.rotation; StartCoroutine(PerformCloseUp(ClosedUpObject, onPerformClosedUp, 1.0f)); }