private bool isDoorOpening = false; //flag: is the door currently opening? /// <summary> /// On each interaction change the rotation of the wheel. /// On the first interaction also open the door. /// </summary> /// <param name="player">the player object that triggered the interaction. Unnecessary in this case</param> public override void Interact(GameObject player) { Debug.Log("Interaction with Lever"); wheel.isClockwise = !wheel.GetComponent <RotationController>().isClockwise; wheel.rotationAngle = 45; if (isDoorLocked && !isDoorOpening) { isDoorOpening = true; } }