Example #1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.transform.tag != "Player")
        {
            return;
        }

        switch (itemType)
        {
        case ItemType.Ammo:
            ItemManager.AmmoItem(collision.transform, Random.Range(minAmount, maxAmount));
            break;

        case ItemType.Health:
            ItemManager.HealthItem(collision.transform, Random.Range(minAmount, maxAmount));
            break;
        }

        parentSpawner.StartSpawningItem();

        Destroy(gameObject);
    }