public void assignQuest(QuestObject qo) { if (currentQuests.Count >= maxQuests) { throw new TooManyQuestsException(); } qo.turnsToComplete = qo.maxTurns; EventObject.EventGroup eg = new EventObject.EventGroup(qo.OnQuestEnd, qo.maxTurns); EventManager.Instance.addTurnEvent(eg); currentQuests.Add(qo); }
public void addTurnEvent(EventObject.EventGroup eo) { try { EventStorage.Instance.turnDependentEvents[PhaseManager.Instance.Turn + eo.value].events.Add(eo.eventObject); } catch (System.ArgumentOutOfRangeException) { EventListObject elo = new EventListObject(); elo.events = new List <EventObject>(); elo.events.Add(eo.eventObject); for (int i = 0; i < eo.value - 1; i++) { EventListObject tempElo = new EventListObject(); tempElo.events = new List <EventObject>(); EventStorage.Instance.turnDependentEvents.Add(tempElo); } EventStorage.Instance.turnDependentEvents.Insert(PhaseManager.Instance.Turn + eo.value, elo); } }