//main method for creating an event and add it to the Quest at the same time: pass through name & description, used by QuestManager public QuestEvent AddQuestEvent(string evtName, string evtDescription) { QuestEvent questEvent = new QuestEvent(evtName, evtDescription); questEvents.Add(questEvent); return(questEvent); }
void Start() { QuestEvent a = quest.AddQuestEvent("quest 1", "Find goods", quest1); QuestEvent b = quest.AddQuestEvent("quest 2", "Find lost Goods", quest2); quest.AddPath(a.GetId(), b.GetId()); quest.BFS(a.GetId()); QuestButton button = CreateButton(a).GetComponent <QuestButton>(); quest1.GetComponent <QuestLocation>().Setup(this, a, button); button = CreateButton(b).GetComponent <QuestButton>(); quest2.GetComponent <QuestLocation>().Setup(this, b, button); teleport = a; final = b; quest.PrintPath(); if (!isQuestManagerPresent) { isQuestManagerPresent = true; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
public QuestEvent AddQuestEvent(string n, string d, string[] dependencies, GameObject[] questIcons) { QuestEvent questEvent = new QuestEvent(n, d, dependencies, questIcons); questEvents.Add(questEvent); return(questEvent); }
public void Setup(QuestManager qm, QuestEvent qe, QuestButton qb) { qManager = qm; qEvent.Add(qe); qButton = qb; qe.button = qButton; }
public void SetupQuestButton(QuestEvent quest) { refEvent = quest; newButtonText = GetComponentInChildren <Text>(); display = FindObjectOfType <QuestDisplay>(); newButtonText.text = refEvent.eventName; }
public QuestEvent AddQuestEvent(string n, string d, GameObject l) { QuestEvent questEvent = new QuestEvent(n, d, l); questEvents.Add(questEvent); return(questEvent); }//this method will first create a quest event with the given name,decriptio and id.
public void UpdateQuestsOnCompletion(QuestEvent e) { if (e == endQuest) { closingAnimation(); Cursor.lockState = CursorLockMode.None; Animator inGameUIAnim = inGameUI.GetComponent <Animator>(); Invoke("SetObjectInactive", fadeUIAnimationLength); inGameUIAnim.SetBool("isFinished", true); victoryPopup.SetActive(true); Animator victoryAnim = victoryPopup.GetComponent <Animator>(); victoryAnim.SetBool("isFinished", true); Cursor.visible = true; StartCoroutine(ScaleTime(1.0f, 0.0f, 3.0f)); GameObject.FindGameObjectWithTag("Player").SetActive(false); return; } foreach (QuestEvent n in quest.questEvents) { if (n.order == (e.order + 1) && n.status == QuestEvent.EventStatus.WAITING) { n.UpdateQuestEvent(QuestEvent.EventStatus.CURRENT); } } }
protected override void ShowBegin() { base.ShowBegin(); if (Quest.Instance == null) { return; } for (int i = 0; i < Quest.Instance.Queue.Count; i++) { QuestEvent questEvent = Quest.Instance.Queue[i]; if (questEvent is QuestCard) { SetupCard(questEvent as QuestCard); } if (questEvent is QuestStory) { SetupStory(questEvent as QuestStory); } } Quest.Instance.Queue = new List <QuestEvent>(); }
public QuestEvent AddQuestEvent(string n, string d) { QuestEvent questEvent = new QuestEvent(n, d); questEvents.Add(questEvent); return(questEvent); }
public QuestEvent AddQuestEvent(string n, string d, GameObject l) { QuestEvent questEvent = new QuestEvent(n, d, l); questEvents.Add(questEvent); return(questEvent); }
void Start() { //creat each event QuestEvent a = quest.AddQuestEvent("test1", "desc1"); QuestEvent b = quest.AddQuestEvent("test2", "desc2"); QuestEvent c = quest.AddQuestEvent("test3", "desc3"); QuestEvent d = quest.AddQuestEvent("test4", "desc4"); QuestEvent e = quest.AddQuestEvent("test5", "desc5"); //define the paths between the events quest.AddPath(a.GetId(), b.GetId()); quest.AddPath(b.GetId(), c.GetId()); quest.AddPath(b.GetId(), d.GetId()); quest.AddPath(c.GetId(), e.GetId()); quest.AddPath(d.GetId(), e.GetId()); quest.BFS(a.GetId()); QuestButton button = CreatButton(a).GetComponent <QuestButton>(); button = CreatButton(b).GetComponent <QuestButton>(); button = CreatButton(c).GetComponent <QuestButton>(); button = CreatButton(d).GetComponent <QuestButton>(); button = CreatButton(e).GetComponent <QuestButton>(); quest.PrintPath(); }
private void GameEvents_OnQuestEvent(QuestEvent evt) { Debug.Log("QuestEvent: " + evt); switch (evt) { case QuestEvent.RunStarted: currentRunStats = new CurrentRunStats(); break; case QuestEvent.ReaperAnnoyed: currentRunStats.ReaperAnnoyed++; persistedStats.ReaperAnnoyed++; RaiseEventIfCompletedNow(QuestId.ReaperAnnoyed); RaiseEventIfCompletedNow(QuestId.ReaperAnnoyedMultipleInOneRun); break; // Instead: On GolemKingKilled, if damage taken == 0 then completed. //case QuestEvent.ReachedGolemKingWithNoDamage: // break; case QuestEvent.GolemNestDestroyed: GolemNestDestroyed = true; RaiseEventIfCompletedNow(QuestId.DestroyGolemNest); break; default: DebugLinesScript.Show("Unknown quest event: " + evt.ToString(), Time.time); break; } }
public QuestEvent AddQuestEvent(string n, string d, GameObject l, float t = 0f, QuestManager.QuestComplete qE = null) { QuestEvent questEvent = new QuestEvent(n, d, l, t, qE); questEvents.Add(questEvent); return(questEvent); }
public void TutorialSetup() { qController = FindObjectOfType <QuestController> (); tutorialEv = QuestFunctions.instance.questEvents[0]; QuestController.PullQuest(); QuestController.currentQuest = tutorialEv; //QuestList.lastEvent = tutorialEv; qController.BeginQuest(); }
public void ExecuteEventsForAll(QuestEvent ev, int playerId, params object[] args) { string func = functions[ev]; foreach (var impl in questImplementations) { ExecuteEventForSingle(ev, playerId, impl.Key, args); } }
public void Setup(QuestEvent e, GameObject scrollList) { thisEvent = e; buttonComponent.transform.SetParent(scrollList.transform, false); eventName.text = "<b>" + thisEvent.name + "</b>\n" + thisEvent.description; status = thisEvent.status; icon.texture = waitingImage.texture; buttonComponent.interactable = false; }
public void Setup(QuestEvent e, GameObject QuestLog) { thisEvent = e; transform.SetParent(QuestLog.transform); nameText = transform.GetChild(0).GetComponent <Text>(); descriptionText = transform.GetChild(1).GetComponent <Text>(); nameText.text = thisEvent.name; descriptionText.text = thisEvent.description; }
public void Setup(QuestManager qm, QuestEvent qe, QustButton qb) { qManager = qm; qEvent = qe; qButton = qb; // setup link between event and button qe.button = qButton; }
public void UpdateQuestsOnCompletion(QuestEvent e) { foreach (QuestEvent n in quest.questEvents) { if (n.order == (e.order + 1)) { n.UpdateQuestEvent(QuestEvent.EventStatus.CURRENT); } } }
void Map(QuestEvent questEvent) { //if (questEvent.questType == QuestType.Gather) //{ // if (questEvent.questData.questLine == QuestData.QuestLine.HandGather) // { // questEvent.questData.gather = new HandGather(); // } //} }
public void Setup(QuestManager qm, QuestEvent qe) { questManager = qm; questEvent = qe; if (defualtAvailable) { questEvent.UpdateQuestEvent(QuestEvent.EventStatus.NOTTAKEN); } }
public Quest(QuestEvent inputEvent, string name, string desc, long inputCount, int gold) { this.questEvent = inputEvent; questName = name; questInfo = desc; count = 0; reward = gold; this.targetCount = inputCount; QuestEventManager.questFunc += MyQuestFunc; }
}//this method will first create a quest event with the given name,decriptio and id. //Then store the newly created quest into the questEvents list //Finally, return the newly created quest to the manager public void AddPath(string fromQuestEvent, string toQuestEvent) { QuestEvent from = FindQuestEvent(fromQuestEvent); QuestEvent to = FindQuestEvent(toQuestEvent); if (from != null && to != null) { QuestPath p = new QuestPath(from, to); //creatinga new path for the current event. from.pathlist.Add(p); // store the upcoming path for the current Quest } }
public void AddPath(string fromQuestEvent, string toQuestEvent) { QuestEvent from = FindQuestEvent(fromQuestEvent); QuestEvent to = FindQuestEvent(toQuestEvent); if (from != null && to != null) { QuestPath p = new QuestPath(from, to); from.pathList.Add(p); } }
public QuestEvent NextQuestEvent() { QuestEvent eventToReturn = null; if (currentEventIndex < questEvents.Count) { eventToReturn = questEvents[currentEventIndex]; currentEventIndex++; } return(eventToReturn); }
GameObject CreateButton(QuestEvent e) { GameObject b = Instantiate(buttonPrefab); b.GetComponent <QuestButton>().Setup(e, questPrintBox); if (e.order == 1) { b.GetComponent <QuestButton>().UpdateButton(QuestEvent.EventStatus.CURRENT); e.status = QuestEvent.EventStatus.CURRENT; } return(b); }
public void BFS(string id, int orderNumber = 1) { QuestEvent thisEvent = FindQuestEvent(id); thisEvent.order = orderNumber; foreach (QuestPath e in thisEvent.pathlist) { if (e.endEvent.order == -1) { BFS(e.endEvent.GetId(), orderNumber + 1); } } }
public void BreadthFirstSearch(string id, int orderNumber = 1) { QuestEvent thisEvent = FindQuestEvent(id); //find the quest from this id thisEvent.order = orderNumber; foreach (QuestPath e in thisEvent.pathList) //list of all the events you can get to from thisEvent { if (e.endEvent.order == -1) //run BFS for unordered event from that position { //recursive algorithm that keeps calling itself, working its way down through the graph & update order number each time as it comes through into the next node BreadthFirstSearch(e.endEvent.GetID(), orderNumber + 1); } } }
public void BFS(string id, int orderNumber = 1) // breadth first search(search all reachable nodes first, then explore the furthur nodes) { QuestEvent thisEvent = FindQuestEvent(id); //find the certain Quest thisEvent.order = orderNumber; //then set the order of this quest as assigned orderNumber foreach (QuestPath e in thisEvent.pathlist) { if (e.endEvent.order == -1)// when the order of next event is -1, that means it is the first event { BFS(e.endEvent.GetId(), orderNumber + 1); } } }
/// <summary> /// Subscribe a class to an Event of name contained in eventName. /// </summary> /// <param name="eventName">Name of the event to listen for.</param> /// <param name="listener">Action variable from the subscribing class (must not be null).</param> public static void StartListening(string eventName, UnityAction <Quest> listener) { UnityEvent <Quest> thisEvent = null; if (instance.questEventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new QuestEvent(); thisEvent.AddListener(listener); instance.questEventDictionary.Add(eventName, thisEvent); } }