Пример #1
0
 private void Awake()
 {
     _Interaction = FindObjectOfType <NPC_Interaction>();
     dialogBox.SetActive(false);
     buttons[0].SetActive(false);
     buttons[1].SetActive(false);
     buttons[2].SetActive(false);
 }
Пример #2
0
 //When object enters Player Collider
 void OnTriggerEnter2D(Collider2D obj)
 {
     //if it's interactable make it the current interactable object
     if (obj.CompareTag("Object_Interactable"))
     {
         currentNPC       = obj.gameObject;
         currentNPCScript = currentNPC.GetComponent <NPC_Interaction>();
     }
 }
Пример #3
0
 //When object leaves Player collider
 void OnTriggerExit2D(Collider2D obj)
 {
     if (obj.CompareTag("Object_Interactable"))
     {
         //if current interactable object has left, empty currentNPC
         if (obj.gameObject == currentNPC)
         {
             currentNPC       = null;
             currentNPCScript = null;
         }
     }
 }
Пример #4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        GameObject otherGO = other.gameObject;

        //Debug.Log(this.tag);
        if (otherGO.name == "Jawsh")
        {
            isInRange = true;
        }
        else if ((otherGO.tag == "marriedLady") && (this.tag == "youngBoy"))
        {
            NPC_Interaction nInt = otherGO.GetComponent <NPC_Interaction>();
            nInt.triggered = true;
        }
    }
Пример #5
0
    void Update()
    {
        if (Input.GetButtonDown("Interact") && currentNPC)
        {
            //If Object Talks
            if (currentNPCScript.npc_type == NPC_Interaction.NPC_Type.Talks && !dialogue_manager.isRunning)
            {
                dialogue_manager.StartDialogue(currentNPCScript.Dialogue_Path, currentNPCScript.icon);
            }

            if (currentNPCScript.npc_type == NPC_Interaction.NPC_Type.Collectable && !dialogue_manager.isRunning)
            {
                flower_manager.Update_Count(currentNPCScript.amount);
                Destroy(currentNPC.gameObject);
                currentNPCScript = null;
            }
        }
    }
Пример #6
0
    void Update()
    {
        foreach (GameObject i in Items)
        {
            SpriteRenderer sRend = i.GetComponent <SpriteRenderer>();
            if (i.name == "Waiter Bundle" && !sRend.enabled)
            {
                GameObject    j     = GameObject.Find("Jawsh");
                JawshMovement jMove = j.GetComponent <JawshMovement>();
                jMove.hasWaiterDisguise = true;
            }

            //UI Check
            GameObject checkWaiterBundle = GameObject.Find("Waiter Bundle");
            Item       itemScript1       = checkWaiterBundle.GetComponent <Item>();
            if (itemScript1.isPickedUp)
            {
                UIWaiterBundle.GetComponent <Image>().overrideSprite = SpriteWaiterBundle;
            }

            GameObject checkFlowers = GameObject.Find("Flowers");
            Item       itemScript2  = checkFlowers.GetComponent <Item>();
            if (itemScript2.isPickedUp)
            {
                UIFlowers.GetComponent <Image>().overrideSprite = SpriteFlowers;
            }

            GameObject checkChampagne = GameObject.Find("Champagne");
            Item       itemScript3    = checkChampagne.GetComponent <Item>();
            if (itemScript3.isPickedUp)
            {
                UIChampagne.GetComponent <Image>().overrideSprite = SpriteChampagne;
            }

            GameObject checkRing   = GameObject.Find("Ring");
            Item       itemScript4 = checkRing.GetComponent <Item>();
            if (itemScript4.isPickedUp)
            {
                UIRing.GetComponent <Image>().overrideSprite = SpriteRing;
            }
        }

        foreach (GameObject i in FakeProposalItems)
        {
            GameObject checkItem  = GameObject.Find(i.name);
            Item       itemScript = checkItem.GetComponent <Item>();
            //Debug.Log(itemScript.isPickedUp);
            if (!itemScript.isPickedUp)
            {
                allPickedUpFP = false;
                //Debug.Log("Nay!");
            }
        }
        if (allPickedUpFP)
        {
            GameObject t    = GameObject.Find("Todd");
            NPC        tAct = t.GetComponent <NPC>();
            tAct.FakeProposalReady = true;
            GameObject l    = GameObject.Find("Linda");
            NPC        lAct = l.GetComponent <NPC>();
            lAct.FakeProposalReady = true;
            //Debug.Log("yay!");
        }
        else if (!allPickedUpFP)
        {
            allPickedUpFP = true;
        }


        foreach (GameObject n in OperationCheatNPCs)
        {
            NPC npcScript = n.GetComponent <NPC>();
            if (n.tag == "youngBoy" && !npcScript.yBTalked)
            {
                //Debug.Log("a");
                bothTalkedTo = false;
            }
            if (n.tag == "marriedLady" && !npcScript.mLTalked)
            {
                //Debug.Log("b");
                bothTalkedTo = false;
            }
        }
        //Debug.Log(bothTalkedTo);
        if (bothTalkedTo)
        {
            NPC npcScript = OperationCheatNPCs[0].GetComponent <NPC>();
            //Debug.Log("here?");
            npcScript.triggered = true;
            Item iScript = OperationCheatItems[0].GetComponent <Item>();
            iScript.isVisible = true;
            if (!iScript.isPickedUp)
            {
                SpriteRenderer sr = OperationCheatItems[0].GetComponent <SpriteRenderer>();
                sr.enabled = true;
            }
        }

        bothTalkedTo = true;

        foreach (GameObject i in OperationCheatItems)
        {
            GameObject checkItem  = GameObject.Find(i.name);
            Item       itemScript = checkItem.GetComponent <Item>();
            //Debug.Log(itemScript.isPickedUp);
            if (!itemScript.isPickedUp)
            {
                allPickedUpOC = false;
                //Debug.Log("Nay!");
            }
        }
        if (allPickedUpOC)
        {
            foreach (GameObject npc in OperationCheatNPCs)
            {
                NPC_Interaction nInt = npc.GetComponent <NPC_Interaction>();
                nInt.triggered = true;
            }
        }
        else if (!allPickedUpOC)
        {
            allPickedUpOC = true;
        }
    }