IEnumerator Hold() { while (mutableObject.ChangeState(true)) { wheelRotation.z += Time.deltaTime * wheelSpeed; wheel.localRotation = Quaternion.Euler(wheelRotation); yield return(null); } }
void SetState(State s) { state = s; Vector3 rot = lever.localRotation.eulerAngles; if (s == State.Up) { rot.z = upRotation; mutableObject.ChangeState(true); } else // Down { rot.z = -upRotation; if (base.hasPower) { mutableObject.ChangeState(false); } } lever.localRotation = Quaternion.Euler(rot); }
void SetState(State s) { state = s; Vector3 pos = switchLever.localPosition; if (s == State.On) { pos.z = onPositionZ; mutableObject.ChangeState(true); green.EnableKeyword("_EMISSION"); red.DisableKeyword("_EMISSION"); } else // Off { pos.z = -onPositionZ; mutableObject.ChangeState(false); red.EnableKeyword("_EMISSION"); green.DisableKeyword("_EMISSION"); } switchLever.localPosition = pos; }