Ejemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            if (!player.GetComponent <Inventory>().HasWeapon(WeaponName))
            {
                player.GetComponent <Inventory>().AddWeaponToPlayer(WeaponName);
            }

            else
            {
                player.GetComponent <Inventory>().AddAmmoToPlayer(WeaponName);
            }


            displayManager.AddMessage("Picked up" + " " + WeaponName, Color.green);
            lootManager.RemoveLoot(this.gameObject);
            Destroy(gameObject);
        }
    }