Beispiel #1
0
    IEnumerator VerifyDialogues()
    {
        yield return(new WaitForSeconds(0.05f));

        if (FindObjectOfType <DialogueRunner>())
        {
            variableStorage = FindObjectOfType <DialogueRunner>().GetComponent <VariableStorage>();

            variableStorage.SetValue("$forestNote", completedForest);
            variableStorage.SetValue("$iceNote", completedIce);
            variableStorage.SetValue("$completedHomeless", completedHomeless);
            if (completedHomeless)
            {
                variableStorage.SetValue("$isFirstTime", false);
            }

            if (completedCave)
            {
                variableStorage.SetValue("$isFirstCave", false);
            }

            variableStorage.SetValue("$desertNote", completedDesert);
            variableStorage.SetValue("$completedCave", completedCave);
            variableStorage.SetValue("$completedFutureGuy", completedFutureGuy);
            variableStorage.SetValue("$completedAll", completedAll);
            variableStorage.SetValue("$completedPostOffice", completedPostOffice);
        }
    }
Beispiel #2
0
    public void VerifyPlayer()
    {
        if (Player.instance.HasNote() && !GameManager.instance.completedHomeless)
        {
            GameManager.instance.completedHomeless = true;
            Player.instance.DestroyNote();

            VariableStorage varStore = FindObjectOfType <DialogueRunner>().GetComponent <VariableStorage>();

            varStore.SetValue("$completedHomeless", true);
            varStore.SetValue("$answer", true);
        }
        else
        {
            if (GameManager.instance.completedHomeless && Player.instance.HasNote())
            {
                VariableStorage varStore = FindObjectOfType <DialogueRunner>().GetComponent <VariableStorage>();
                varStore.SetValue("$answer", true);
            }
            else
            {
                VariableStorage varStore = FindObjectOfType <DialogueRunner>().GetComponent <VariableStorage>();
                varStore.SetValue("$answer", false);
            }
        }
    }
Beispiel #3
0
    public void ChangeBackground()
    {
        VariableStorage varStore = FindObjectOfType <DialogueRunner>().GetComponent <VariableStorage>();

        if (GameManager.instance.completedCave && varStore.GetValue("$isFirstCave").AsBool)
        {
            anim.Play("Start");
            varStore.SetValue("$isFirstCave", false);
        }
    }
    public void VerifyPlayer()
    {
        if (Player.instance.HasNote() && !GameManager.instance.completedForest && !GameManager.instance.isDialogue)
        {
            GameManager.instance.completedForest = true;

            VariableStorage varStore = FindObjectOfType <DialogueRunner>().GetComponent <VariableStorage>();
            varStore.SetValue("$forestNote", true);

            Player.instance.DestroyNote();
        }
    }
Beispiel #5
0
    public void VerifyPlayer()
    {
        if (Player.instance.HasNote() && !GameManager.instance.completedCave)
        {
            GameManager.instance.completedCave = true;
            Player.instance.DestroyNote();


            VariableStorage varStore = FindObjectOfType <DialogueRunner>().GetComponent <VariableStorage>();
            varStore.SetValue("$completedCave", true);

            FMODUnity.RuntimeManager.PlayOneShot("event:/SFX/Nhac Pac Man");
        }
    }
Beispiel #6
0
    public void ByeCar()
    {
        if (GameManager.instance.completedFutureGuy)
        {
            VariableStorage varStore = FindObjectOfType <DialogueRunner>().GetComponent <VariableStorage>();
            varStore.SetValue("$completedAll", true);
            GameManager.instance.completedAll = true;

            //Destroy Future Guy
            Destroy(instanceFutureGuyNPC);
            // Open Portal
            StartCoroutine(OpenPortal2());
            // Move Car
            instanceCar.GetComponent <Animator>().Play("Bye");
            FMODUnity.RuntimeManager.PlayOneShot("event:/SFX/Fusca saindo");
            StartCoroutine(ClosePorta2());
        }
    }
Beispiel #7
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Z) && canInteract && !GameManager.instance.completedAll)
        {
            if (Player.instance.HasNote())
            {
                VariableStorage varStore = FindObjectOfType <DialogueRunner>().GetComponent <VariableStorage>();
                varStore.SetValue("$completedFutureGuy", true);
                GameManager.instance.completedFutureGuy = true;

                Player.instance.DestroyNote();
                FindObjectOfType <Grass1Background>().ByeCar();
                FindObjectOfType <DialogueRunner>().StartDialogue(GetComponent <NPC>().talkToNode);
            }
            else if (!GameManager.instance.isDialogue && !GameManager.instance.completedAll)
            {
                FindObjectOfType <DialogueRunner>().StartDialogue(GetComponent <NPC>().talkToNode);
            }
        }
    }
    public void CheckQuest()
    {
        if (quest != null && quest.activeQuest == true)
        {
            //Checks to see if that quest goal is active
            if (quest.goalOneActive == true && quest != null)
            {
                //Searches for the quest goal one item in the player inventory
                if (inventoryItemList.itemList.Contains(quest.goalOne.questItem))
                {
                    //sets the goal to achieved
                    quest.goalOne.goalAchieved = true;
                    //Increases the number of completed goals
                    quest.goalsCompleted += 1;
                    //Logs that the goal is complete
                    Debug.Log("Goal One Complete");
                }
            }
            if (quest.goalTwoActive == true && quest != null)
            {
                if (inventoryItemList.itemList.Contains(quest.goalTwo.questItem))
                {
                    quest.goalTwo.goalAchieved = true;
                    quest.goalsCompleted      += 1;
                    Debug.Log("Goal Two Complete");
                }
            }
            if (quest.goalThreeActive == true && quest != null)
            {
                if (inventoryItemList.itemList.Contains(quest.goalThree.questItem))
                {
                    quest.goalThree.goalAchieved = true;
                    quest.goalsCompleted        += 1;
                    Debug.Log("Goal Three Complete");
                }
            }
            if (quest.goalFourActive == true && quest != null)
            {
                if (inventoryItemList.itemList.Contains(quest.goalFour.questItem))
                {
                    quest.goalFour.goalAchieved = true;
                    quest.goalsCompleted       += 1;
                    Debug.Log("Goal Four Complete");
                }
            }
            if (quest.goalFiveActive == true && quest != null)
            {
                if (inventoryItemList.itemList.Contains(quest.goalFive.questItem))
                {
                    quest.goalFive.goalAchieved = true;
                    quest.goalsCompleted       += 1;
                    Debug.Log("Goal Five Complete");
                }
            }
        }

        // Can this bit be written with a function? Something like this?
        /// public void removeGoalItem(Quest)
        /// {
        ///     inventoryItemList.itemList.Remove(questItem);
        ///     goalActive = false;
        /// }
        ///
        /// To run then use:
        /// if (quest.goalOneActive == true)
        /// {
        ///     removeGoalItem(quest.goalOne);
        /// }

        if (quest != null && quest.numberOfGoals <= quest.goalsCompleted)
        {
            //Set quest as complete
            quest.giveRewardItem = true;
            Debug.Log("Reward Given");
            //Deletes the items from the players Inventory
            if (quest.goalOneActive == true)
            {
                inventoryItemList.itemList.Remove(quest.goalOne.questItem);
                //Inactivates the goal
                quest.goalOne.goalActive = false;
            }
            if (quest.goalTwoActive == true)
            {
                inventoryItemList.itemList.Remove(quest.goalTwo.questItem);
                quest.goalTwo.goalActive = false;
            }
            if (quest.goalThreeActive == true)
            {
                inventoryItemList.itemList.Remove(quest.goalThree.questItem);
                quest.goalThree.goalActive = false;
            }
            if (quest.goalFourActive == true)
            {
                inventoryItemList.itemList.Remove(quest.goalFour.questItem);
                quest.goalFour.goalActive = false;
            }
            if (quest.goalFiveActive == true)
            {
                inventoryItemList.itemList.Remove(quest.goalFive.questItem);
                quest.goalFive.goalActive = false;
            }
        }

        //If the quest is complete
        if (quest != null && quest.giveRewardItem == true)
        {
            //Give item one to player inventory
            inventoryItemList.itemList.Add(quest.rewardItem);
            quest.giveRewardItem = false;
            quest.activeQuest    = false;
            quest.goalsCompleted = 0;
            Debug.Log("Quest Complete");

            //Sets the quest complete variable within Yarn and progresses the conversation
            VariableStorage varStore = dialogueRunner.GetComponent <VariableStorage>();
            var             questSet = new Yarn.Value(true);
            varStore.SetValue("$quest_complete", questSet);
        }
    }