Esempio n. 1
0
    void CheckIfPlayerCompletedMyQuest()
    {
        if (!Quest.QuestCompletedAndTurnedIn)//This line was added because without it, it was completing Let Ed Know you're here twice.
        {
            Quest.CheckGoals();
        }
        if (Quest.QuestStatus)
        {
            questGiver_UI.ChangeQuestStatus("?", false);
            //Debug.Log("Changed ? to false from QuestGiver");

            if (Quest.QuestType.Contains(QuestType.CollectionGoal))
            {
                TakeQuestItemsFromInventory();
            }
            //Debug.Log("questgiver completed quest");
            dialogueManager.SetupNewDialogue(this.gameObject, path[1]);
            //Debug.Log("questgiver loaded new dialogue");
            Quest.GiveReward();
            Quest.QuestGoal.ForEach(g => g.Terminate());
            PlayerCompletedMyTask = true;
            AssignedQuest         = false;
            Quest = null; //reset the current quest,
                          //check if I have another quest to assign
                          //put that new Quest into the variable, or don't depending
        }
        else
        {//load assignedQuest=true but has not completed it yet text
            //Debug.Log("i have given you a quest, but you have not yet completed it");
            dialogueManager.SetupNewDialogue(this.gameObject, path[3]);
        }
    }
Esempio n. 2
0
    void WriteQuestOnHUD(QuestBaseClass e)
    {
        string questName = e.QuestName;

        //Debug.Log("Hud rcvd " + questName);
        //EACH QUEST IS ALWAYS 42 CHARACTERS LONG
        questText.text += StringHelperClass.PadQuestTextToLengthOfLine(questName);
    }
Esempio n. 3
0
 public void AddQuestItem(QuestBaseClass questItem)
 {
     //questList.Add(questItem);
     if (OnQuestAdded != null)
     {
         questList.Add(questItem);
         //Debug.Log("Quest added " + questItem);
         OnQuestAdded(this, new QuestEventArgs(questItem));
         my_audioSource.PlayOneShot(startQuestSound);
         //TESTER_SHOW_ALL_QUESTS_IN_LIST();
     }
 }
Esempio n. 4
0
    void CrossOffQuestFromList(QuestBaseClass e)
    {
        string currentQuestText = questText.text;

        string questName = e.QuestName;
        int    questId   = e.Quest_ID;

        //find our questName within the currentQuestText..return the starting char's index
        int startingCharIndex = currentQuestText.IndexOf(questName, System.StringComparison.CurrentCulture);

        //Debug.Log(startingCharIndex);

        //add strikethrough starting tag to beginning and an ending strikethrough tag at end
        questText.text = questText.text.Insert(startingCharIndex, "<s>");
        questText.text = questText.text.Insert(startingCharIndex + 41, "</s>");
    }
    void ConstructQuestDescription(QuestBaseClass updatedQuest)
    {
        if (updatedQuest != null)//this is NOT redundant, it is needed here because computers are weird and choose when they want to do something in order i guess???
        {
            int    index         = -1;
            int[]  currAmt       = new int[20];//assumed you wont have a goal over that needs you to interact 20 times
            int[]  reqAmt        = new int[20];
            string currVsReq     = "<br><br>";
            string lastQuestWord = StringHelperClass.DetermineLastQuestWord(updatedQuest.QuestType.ToString());

            if (descriptionText == null)
            {
                descriptionText = questDescriptionPanel.GetComponentInChildren <TextMeshProUGUI>();
            }

            if (active)
            {
                foreach (QuestGoalBaseClass q in updatedQuest.QuestGoal) //May you always remember that time you freaked out about reference vs value and really it was just a problem of "++"
                {                                                        //sept 24 - i am paying my respects to ^ this ^ comment. My god, I really did freak out.
                    if (q != null)
                    {
                        currAmt[++index] = q.CurrentAmount;
                        reqAmt[index]    = q.RequiredAmount;

                        currVsReq += currAmt[index] + " / " + reqAmt[index] + " " + q.QuestObjectiveObject;
                    }
                }
                if (!updatedQuest.QuestCompletedAndTurnedIn)
                {
                    descriptionText.SetText(updatedQuest.QuestDescription + currVsReq + lastQuestWord + "<br>"); //use html tags here bc we are inputting into a text thingy that eats those instead of "\n"
                }
                else
                {
                    descriptionText.SetText("COMPLETED!");
                }
            }
            if (!active)
            {
                descriptionText.SetText("");
            }
        }
    }
Esempio n. 6
0
 public void RemoveQuestItem(QuestBaseClass questItem)
 {
     foreach (QuestBaseClass quest in questList)
     {
         //Debug.Log("Found " + quest + " in questList while searching to remove quest item");
         if (OnQuestRemoved != null)
         {
             if (quest.QuestName == questItem.QuestName)
             {
                 questList.Remove(questItem);
                 //Debug.Log("OnQuestRemoved NOT null " + quest.QuestName + questItem.QuestName + " l = in list, r = argument");
                 OnQuestRemoved(this, new QuestEventArgs(questItem));
                 //TESTER_SHOW_ALL_QUESTS_IN_LIST();
                 my_audioSource.PlayOneShot(endQuestSound);
                 break;
             }
         }
         //Debug.Log(this + "OnQuestRemove is Null, cannot remove");
         //break;
     }
 }
Esempio n. 7
0
    //under constunction...this method DELETES items from the game
    void TakeQuestItemsFromInventory()
    {
        QuestBaseClass receivedQuest;

        if (ForeignQuest != null)         //it won't be null here if a QuestGiving item has been looted and used
        {
            receivedQuest = ForeignQuest; //other
        }
        else
        {
            receivedQuest = Quest; //this
        }
        receivedQuest.CheckGoals();
        //Debug.Log("taking quests from inventory to complete a collection quest");
        InventoryList playersInventory = GameObject.FindWithTag("Inventory").GetComponent <InventoryList>();

        //get all QuestGoals of type CollectionGoal
        foreach (CollectionGoal c in receivedQuest.QuestGoal)
        {
            //fetch the RequiredAmount to see how many to remove
            int reqNumItemsToRemove = c.RequiredAmount;
            //fetch the RequiredItemName and attempt to remove it
            string questItemName = c.RequiredItemName;

            //Debug.Log("Need " + reqNumItemsToRemove +" "+ questItemName);

            for (int i = 0; i < reqNumItemsToRemove; i++)
            {
                playersInventory.SearchInventoryAndRemoveIfFound(questItemName);
            }
        }
        //Debug.Log("questgiver completed quest");
        //dialogueManager.SetupNewDialogue(this.gameObject, path[1]);   I DONT THINK THIS NEEDS TO BE HERE
        //Debug.Log("questgiver loaded new dialogue. IM RDY TO TALK!");
        Quest.GiveReward();
        Quest.QuestGoal.ForEach(g => g.Terminate());
        ForeignQuest = null;
    }
Esempio n. 8
0
 private void Start()
 {
     ForeignQuest = null;
 }
Esempio n. 9
0
 void InformQuestCanvas(QuestBaseClass e)
 {
     questCanvasChildren[++childIndex].GetComponent <ShowQuestDetails>().SetQuestToPanel(e);
 }
Esempio n. 10
0
 public QuestEventArgs(QuestBaseClass quest)
 {
     m_quest = quest;
 }
 public void SetQuestToPanel(QuestBaseClass e)
 {
     this.quest = e;
 }