/// <summary> /// Constructor for a new Campaign Node, complete with an initializer for the mission. /// </summary> /// <param name="success">CampaignNode to move to on successful mission completion</param> /// <param name="failure">CampaignNode to move to on mission failure</param> /// <param name="trigger">TriggerEvent to determine if/where to move in the campaign tree</param> /// <param name="id">Identifier for the new CampaignNode</param> /// <param name="init">MissionInitializer used to initialize things for the mission</param> public CampaignNode(CampaignNode success, CampaignNode failure, TriggerEvent trigger, int id, string description, MissionInitializer init) { _success = success; _failure = failure; _trigger = trigger; _id = id; _init = init; _description = description; }
/// <summary> /// Contructor for a new CampaignNode where the mission does not have an initializer /// </summary> /// <param name="success">CampaignNode to move to on successful mission completion</param> /// <param name="failure">CampaignNode to move to on mission failure</param> /// <param name="trigger">Trigger to determine if/where to move in the campaign tree</param> /// <param name="id">Identifier for the new CampaignNode</param> public CampaignNode(CampaignNode success, CampaignNode failure, TriggerEvent trigger, int id, string description) { _success = success; _failure = failure; _trigger = trigger; _id = id; _init = null; _description = description; }
// Use this for initialization void Start() { _infectionStatus = new int[InfectionTypeCount, WorldCount]; currentMission = CampaignInitializer.InitializeCampaign(); //Debug.Log(currentMission.ToString()); if (currentMission.Initializer != null) { currentMission.Initializer.InitializeMission(); } convoManager = new ConversationManager(); }
/// <summary> /// Method to check a campaign event to see if the player has completed a campaign mission and /// needs to progress through the campaign tree. /// </summary> /// <param name="evnt">Campaign event to check</param> public void CheckEvent(CampaignEvent evnt) { CampaignMove result = currentMission.Trigger.CheckTrigger(evnt); if (result == CampaignMove.None) { return; } else if (result == CampaignMove.Success) { currentMission = currentMission.Success; if (currentMission.Initializer != null) { currentMission.Initializer.InitializeMission(); } } else if (result == CampaignMove.Failure) { currentMission = currentMission.Failure; if (currentMission.Initializer != null) { currentMission.Initializer.InitializeMission(); } } else if (result == CampaignMove.End) { //CHANGE TO END OF GAME SCENE UnityEngine.SceneManagement.SceneManager.LoadScene("end"); } else { throw new ArgumentException("Invalid response from CheckTrigger on Node " + currentMission.ID); } Debug.Log("CampaignEvent = " + currentMission.ToString()); }