Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (playerWithinZone && actionButton.GetClicked())
     {
         ShowQuiz();
     }
 }
Esempio n. 2
0
    private void Update()
    {
        if (playerWithinZone && !warping && actionButton.GetClicked())
        {
            warping = true;

            // Get player object by tag and call WarpPlayer function
            Player player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
            StartCoroutine(WarpPlayer(player));
        }
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (playerWithinZone && actionButton.GetClicked())
        {
            UIElement.GetComponent <UIWindow>().OpenWindow();

            if (NPC != null)
            {
                UIElement.GetComponent <DialogueBox>().UpdateDialogueBox(NPC.GetComponent <NPC>());
            }

            if (Shopkeeper != null)
            {
                UIElement.GetComponent <DialogueBox>().UpdateDialogueBoxShopkeeper(Shopkeeper.GetComponent <Shopkeeper>());
            }
        }
    }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        if (playerWithinZone && actionButton.GetClicked())
        {
            /* HARVEST CROPS */
            if (!inventory.GetComponent <Inventory>().IsFull())
            {
                for (int i = 0; i < farmTiles.Length; i++)
                {
                    if (farmTiles[i].IsCropFullyGrown())
                    {
                        Food harvest = farmTiles[i].HarvestCrop();
                        AddHarvestToInventory(harvest);

                        return;
                    }
                }
            }

            /* PLANT CROPS */
            for (int i = 0; i < farmTiles.Length; i++)
            {
                if (!farmTiles[i].HasCrop())
                {
                    // Plant crop if player has seeds
                    Food food = GetSeedsFromInventory();

                    if (food != null)
                    {
                        PlantSeeds(farmTiles[i], food, object1);

                        return;
                    }
                    else
                    {
                        Debug.Log("No seeds in inventory.");
                    }
                }
            }
        }
    }