Пример #1
0
        public bool CheckCompleted(QuestLog MyCharacter)
        {
            if (IsHandedIn)
                return true;
            //IsCompleted = false;
            Inventory MyInventory = MyCharacter.gameObject.GetComponent<Inventory> ();
            if (IsConditionTrue(MyCharacter))
                IsCompleted = true;
            else
                IsCompleted = false;

            return IsCompleted;
        }
Пример #2
0
        // checks conditions
        // uses statistics, inventory classes
        public bool IsConditionTrue(QuestLog MyCharacter)
        {
            // inventory condition checks
            if (DecodedCondition.IsInventory) {
                Inventory MyInventory = MyCharacter.gameObject.GetComponent<Inventory> ();
                //if (MyInventory.MyItems.Count > 0) return true;
                for (int i = 0; i < MyInventory.MyItems.Count; i++) {
                    if (MyInventory.MyItems [i].Name == DecodedCondition.ItemName) {
                        if (MyInventory.MyItems [i].Quantity >= DecodedCondition.ItemQuantity)
                            return true;
                    }
                }
            }
            else // if not inventory, check if it's already been completed
            {
                if (IsCompleted)
                    return IsCompleted;
            }
            // area in condition

            //

            return false;
        }
Пример #3
0
        // when another quest holder is issueing the quest out
        public string GiveCharacterQuest(string QuestName, QuestLog MyQuestTaker)
        {
            if (GetUncompletedQuests () >= QuestLimit && QuestLimit != -1) {
                return "";
            }

            int QuestIndex = -1;
            for (int i = 0; i < MyQuests.Count; i++) {
                if (MyQuests[i].Name == QuestName) {
                    QuestIndex = i;
                    i = MyQuests.Count;
                }
            }
            if (QuestIndex == -1)
                return "!";

            if (QuestIndex < MyQuests.Count && QuestIndex >= 0) {
                Quest NewQuest = MyQuests [QuestIndex];
                if (!MyQuestTaker.MyQuests.Contains (NewQuest))
                {
                    MyQuestTaker.MyQuests.Add (NewQuest);
                    if (MyQuestTaker.BeginQuestSound != null) {
                        MySource.PlayOneShot (MyQuestTaker.BeginQuestSound);
                        //Debug.LogError("PLaying sound");
                    }
                    //Debug.LogError("Adding Quest");
                    //Debug.LogError("Adding quest: " + MyCharacter.MyQuests[QuestIndex].Name);
                    if (MyQuestTaker.MyQuestLogGui) {
                        MyQuestTaker.MyQuestLogGui.UpdateQuestGuis();
                    }
                    NewQuest.QuestGiver = this;
                    NewQuest.QuestTaker = MyQuestTaker;
                    MyQuestTaker.RefreshQuestsGui();

                    return NewQuest.Name;
                }
            }
            return "";
        }