/// <summary> /// go through events and see if anything meets condition /// </summary> /// <param name="listener"></param> public void checkForEventConditions(ActionListener.Listener listener, string[] eventParams) { QuestEvent newEvent = null; //loop through existing events in the curr active quest foreach (QuestEvent qEvent in GlobalSingleton.Instance.questStatus.activeQuestData.getQuestEvents()) { //print("event: " + qEvent.conditions[0].Item2[0]); if (qEvent.conditionsMet(listener, eventParams)) //might need parameters here too { //conditions met newEvent = qEvent; break; } } if (newEvent != null) //newEvent condition met, should switch to event's starting line { gameFlow.setPointer(newEvent.startLineNumber); Debug.Log("switched to event: " + newEvent.eventName); } }
/// <summary> /// during game, relevant listeners will call this function to indicate that the condition being listened to has happened /// /// will talk to quest condition manager /// /// eventParams: /// -[0]: id of the object triggering the action /// /// </summary> /// <param name="listener"></param> public void onTriggerListener(ActionListener.Listener listener, string[] eventParams) { switch (listener) { case ActionListener.Listener.onStart: questConditionManager.checkForEventConditions(listener, eventParams); break; case ActionListener.Listener.enterSite: //extract info specific to this type of listener break; case ActionListener.Listener.enterArea: break; case ActionListener.Listener.interactWithObject: questConditionManager.checkForEventConditions(listener, eventParams); break; //TODO more } }