Esempio n. 1
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player" && despawned == false)
        {
            LocalPlayer inventory = other.gameObject.GetComponent("LocalPlayer") as LocalPlayer;
            inventory.AddToInventory(objectTag);
            if (pickupSound != null)
            {
                pickupSound.Play();
            }

            if (respawn)
            {
                despawned = true;
                respawnObject.SetActive(false);
                Invoke("Respawn", respawnTimer);
            }
            else
            {
                Destroy(gameObject);
            }
        }
    }