Example #1
0
    public void Harvest()
    {
        //Add resource to inventory
        inventory.AddItem(item, 1);

        this.gameObject.SetActive(false);
    }
Example #2
0
    void Die()
    {
        isDead = true;

        inventory.AddItem(item, 1);

        this.gameObject.SetActive(false);
    }
Example #3
0
    void ItemPickup(RaycastHit hit)
    {
        var item = hit.transform.GetComponent <Item>();

        if (item)
        {
            inventory.AddItem(item.item, 1);

            Destroy(hit.transform.gameObject);
        }
    }
Example #4
0
    void OnTriggerEnter(Collider collider)
    {
        var Item = collider.GetComponent <ItemClass>();

        if (Item)
        {
            anim.SetTrigger("Eat");
            eatEffect.Play();
            inventory.AddItem(Item.item, 1);
            counter++;
            inventoryCounter.text = "x" + counter;
            Destroy(collider.gameObject);
        }

        if (collider.gameObject.CompareTag("Checkpoint"))
        {
            gameManager.CheckpointReached();
            collider.enabled = false;
            collider.transform.GetChild(0).gameObject.SetActive(false);
        }

        if (collider.CompareTag("StartChase"))
        {
            Debug.Log("Chase start");
            var dialogue = collider.GetComponent <DialogueTrigger>();
            GetComponent <LookAhead>().levelEnd = true;
            stopBandit = true;
        }

        if (collider.CompareTag("EndChase"))
        {
            Debug.Log("Chase is over");
            gameManager.EndChase();
        }

        if (collider.CompareTag("EndGame"))
        {
            stopBandit = true;
        }
    }