public QuestEvent AddQuestEvent(string name, string info) { QuestEvent questEvent = new QuestEvent(name, info, this); questEvents.Add(questEvent); return(questEvent); }
public void BFS(QuestEvent qE, int orderNumber = 1) //傳入首個事件,爲之後的事件排序 { QuestEvent thisEvent = FindQuestEvent(qE.GetID()); thisEvent.order = orderNumber; if (orderNumber > 1) { thisEvent.UpDateQuestEvent(QuestEvent.EventStatus.waiting); } else if (orderNumber == 1) { thisEvent.UpDateQuestEvent(QuestEvent.EventStatus.current); } else { thisEvent.UpDateQuestEvent(QuestEvent.EventStatus.done); thisEvent.goTo.UpDateQuestEvent(QuestEvent.EventStatus.current); } foreach (QuestEvent qES in questEvents) { if (qES.order == -1) { BFS(qES, orderNumber + 1); } } }
public void AddPath(string from, string to) { QuestEvent fromQuestEvent = FindQuestEvent(from); QuestEvent toQuestEvent = FindQuestEvent(to); if (fromQuestEvent != null && toQuestEvent != null) { QuestPath path = new QuestPath(toQuestEvent); fromQuestEvent.goTo = FindQuestEvent(to); } }
public QuestEvent FindQuestEvent(QuestEvent qE) { foreach (QuestEvent questEvent in questEvents) { if (questEvent.GetID() == qE.GetID()) { return(questEvent); } } Debug.Log("no event"); return(null); }
public Quest FindQuest(QuestEvent questEvent) //透過事件搜索 { foreach (Quest quest in questList) { if (quest.FindQuestEvent(questEvent) != null) { return(quest); } } Debug.Log("error"); return(null);; }
void CreatFirstQuest() { string aString = "Hi,\nthis is the discribetion of the 1st Quest"; firstQuest = new Quest(Quest.QuestName.firstQuest, aString); QuestEvent a = new QuestEvent("event1", "Info1", null); a.questDemand = new QuestDemand(new Item { itemName = Item.ItemName.巧克力蛋糕, quantity = 1 }); itemCheck.Add(a.GetID(), a.questDemand.items); firstQuest.AddQuestEvent(a); QuestEvent b = new QuestEvent("event2", "Info2", null); b.questDemand = new QuestDemand(false); boolCheck.Add(b.GetID(), b.questDemand.flags); firstQuest.AddQuestEvent(b); QuestEvent c = new QuestEvent("event3", "Info3", null); c.questReward = new QuestReward(new Item { itemName = Item.ItemName.快樂草, quantity = 1 }, false); firstQuest.AddQuestEvent(c); firstQuest.questReward = c.questReward; firstQuest.QuestEventLinkerAndMarker(); /*firstQuest.AddPath(a.GetID() , b.GetID()); * firstQuest.AddPath(b.GetID() , c.GetID());*/ firstQuest.BFS(a); //firstQuest.PrintPath(); questList.Add(firstQuest); }
public void AddQuestEvent(QuestEvent questEvent) { questEvent.belongTo = this; questEvents.Add(questEvent); }
public QuestPath(QuestEvent to) { endEvent = to; }