//This describes what each of the events do //A node that triggers an event will call it's event trigger, and this script will listen and calls this function //The event is dynamic so it will send it's nodeIndex with the call, and this function knows what to do for each given index public void dialogueEventHandler(int nodeIndex) { if (dialogueManager.dialogueTextAsset == questIntro) { switch (nodeIndex) { case 5: gameObject.GetComponentInChildren <Text>().text = "Friendship: " + --wizardFriendship; questWasRejected = true; //dialogueEvent.RemoveListener(this.dialogueEventHandler); break; case 8: questInProgress = true; break; case 9: gameObject.GetComponentInChildren <Text>().text = "Friendship: " + --wizardFriendship; questWasRejected = true; //dialogueEvent.RemoveListener(this.dialogueEventHandler); break; case 10: gameObject.GetComponentInChildren <Text>().text = "Friendship: " + --wizardFriendship; //UnityEventTools.RemovePersistentListener<int>(dialogueEvent, dialogueEventHandler); dialogueEvent.RemoveListener(this.dialogueEventHandler); break; case 11: gameObject.GetComponentInChildren <Text>().text = "Friendship: " + ++wizardFriendship; break; case 12: case 14: GameObject.Find(GameConst.PLAYER_OBJECT_NAME).GetComponent <PlayerStatistics>().increaseMaxStamina(20); //UnityEventTools.RemovePersistentListener<int>(dialogueEvent, dialogueEventHandler); dialogueEvent.RemoveListener(this.dialogueEventHandler); break; default: break; } } else if (dialogueManager.dialogueTextAsset == questOutro) { switch (nodeIndex) { case 6: wizardFriendship -= 2; gameObject.GetComponentInChildren <Text>().text = "Friendship: " + wizardFriendship; //UnityEventTools.RemovePersistentListener<int>(dialogueEvent, dialogueEventHandler); dialogueEvent.RemoveListener(this.dialogueEventHandler); break; case 7: gameObject.GetComponentInChildren <Text>().text = "Friendship: " + ++wizardFriendship; break; case 8: //Both case 8 and 10 go to the same place. case 10: GameObject.Find(GameConst.PLAYER_OBJECT_NAME).GetComponent <PlayerStatistics>().increaseMaxStamina(20); questInProgress = false; //UnityEventTools.RemovePersistentListener<int>(dialogueEvent, dialogueEventHandler); dialogueEvent.RemoveListener(this.dialogueEventHandler); break; } } else if (dialogueManager.dialogueTextAsset == rejectedDialogue) { switch (nodeIndex) { case 7: wizardFriendship -= 2; gameObject.GetComponentInChildren <Text>().text = "Friendship: " + wizardFriendship; questWasRejected = false; questInProgress = false; currentAppleStatus = appleStatus.notGotten; //UnityEventTools.RemovePersistentListener<int>(dialogueEvent, dialogueEventHandler); break; case 9: gameObject.GetComponentInChildren <Text>().text = "Friendship: " + ++wizardFriendship; //UnityEventTools.RemovePersistentListener<int>(dialogueEvent, dialogueEventHandler); break; case 10: case 12: GameObject.Find(GameConst.PLAYER_OBJECT_NAME).GetComponent <PlayerStatistics>().increaseMaxStamina(20); break; } } }
public void changeAppleStatus(appleStatus newStatus) { currentAppleStatus = newStatus; }