void Update() { if (currentSeatState == eSeatState.CLOSING) { transform.localRotation = Quaternion.Slerp(transform.localRotation, seatClosedRotation, rotationRate * Time.deltaTime); if (Quaternion.Angle(transform.localRotation, seatClosedRotation) < snapAngle) { currentSeatState = eSeatState.CLOSED; transform.localRotation = seatClosedRotation; myAudio.clip = toiletSeatDown; myAudio.Play(); interactionString = "Lift seat"; } } else if (currentSeatState == eSeatState.OPENING) { transform.localRotation = Quaternion.Slerp(transform.localRotation, seatOpenRotation, rotationRate * Time.deltaTime); if (Quaternion.Angle(transform.localRotation, seatOpenRotation) < snapAngle) { currentSeatState = eSeatState.OPEN; transform.localRotation = seatOpenRotation; myAudio.clip = toiletSeatUp; myAudio.Play(); interactionString = "Put seat down"; } } }
public override void activate() { if (currentSeatState == eSeatState.OPEN) { currentSeatState = eSeatState.CLOSING; } else if (currentSeatState == eSeatState.CLOSED) { currentSeatState = eSeatState.OPENING; } }
public void RestorSeatState(int state) { switch (state) { case (int)eSeatState.CLOSED: case (int)eSeatState.CLOSING: currentSeatState = eSeatState.CLOSED; transform.localRotation = seatClosedRotation; break; case (int)eSeatState.OPEN: case (int)eSeatState.OPENING: default: currentSeatState = eSeatState.OPEN; transform.localRotation = seatOpenRotation; break; } }