// Open the door public void ExecuteDoor() { if (door != null) { if (!door.opened) { commandHistory.Push(openCommand); openCommand.Execute(); } else { commandHistory.Push(closeCommand); closeCommand.Execute(); } } }