private void ExecuteOrder(LevelOrder order) { if (m_DialogueManager == null) { m_DialogueManager = GameObject.Find("DialogueManager").GetComponent <DialogManager> (); } switch (order.orderType) { case (LevelOrderType.SPAWN): SpawnLevelOrder spawnOrder = (SpawnLevelOrder)order; for (int i = 0; i < spawnOrder.entities.Count; i++) { for (int k = 0; k < spawnOrder.entitiesQuantity [i]; k++) { SpawnObject(spawnOrder.entities [i]); } } break; case (LevelOrderType.MUSIC): MusicLevelOrder musicLevelOrder = (MusicLevelOrder)order; SoundManager.instance.PlayMusicFromName(musicLevelOrder.name); break; case (LevelOrderType.TALK): TalkLevelOrder talkLevelOrder = (TalkLevelOrder)order; m_DialogueManager.TriggerDialogue(talkLevelOrder.tag); m_DialogueManager.CloseDialogueGuiAfterSeconds(2); break; case (LevelOrderType.END_LEVEL): EventManager.TriggerEvent("EndLevel", new CommandModifier(1, 1, 1)); break; case (LevelOrderType.WAIT_TRIGGER): IncreaseWaitingCounter(); break; case (LevelOrderType.WAIT_DIALOGUE): IncreaseWaitingCounter(); EventManager.TriggerEvent("WaitDialogue", new CommandModifier(1, 1, 1)); WaitDialogueLevelOrder waitDialogueLevelOrder = (WaitDialogueLevelOrder)order; m_DialogueManager.TriggerDialogue(waitDialogueLevelOrder.tag); break; } }