void Update() { if (elevatorArriveCountdown > 0) { GetComponent <SpriteRenderer>().sprite = elevatorButtonOn; elevatorArriveCountdown -= Time.deltaTime; if (elevatorArriveCountdown <= 0) { GetComponent <SpriteRenderer>().sprite = elevatorButtonOff; if (callingElevator) { elevator.Arrive(); elevatorArrived = true; elevatorCloseCountdown = 3.0f; callingElevator = false; } } } if (elevatorCloseCountdown > 0) { elevatorCloseCountdown -= Time.deltaTime; if (elevatorCloseCountdown <= 0) { elevatorArrived = false; elevator.Close(); interactive.Activate(); } } }