protected override void InvokeAction() { SmoothRotation smoothRotation = gameObject.AddComponent <SmoothRotation>(); if (closed) { smoothRotation.Setup(startRotation, endRotation, openingRotationSpeed); } else { smoothRotation.Setup(endRotation, startRotation, closingRotationSpeed); } closed = !closed; }
internal void Rotate(int direction) { Quaternion startRotation = transform.localRotation; Vector3 eulerRotation = new Vector3(0, 0, 36 * direction); Quaternion endRotation = Quaternion.Euler(startRotation.eulerAngles + eulerRotation); SmoothRotation smoothRotation = gameObject.AddComponent <SmoothRotation>(); smoothRotation.Setup(startRotation, endRotation, rotationSpeed, methodToCallOnRotationFinished); value -= direction; // There is minus, because rotating left increases the value if (value == -1) { value = 9; } if (value == 10) { value = 0; } }