Beispiel #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other != null && other.tag == "Player")
        {
            switch (itemType)
            {
            case Type.ALCOHOL:
                PlayerStats.AddAlcohol();
                PlayerStats.AddHealTime(strength);
                Destroy(this.gameObject);
                return;

            case Type.ZAGRYZKA:
                PlayerStats.RemoveAlcohol((int)strength);
                Destroy(this.gameObject);
                break;

            case Type.HEAL:
                PlayerStats.Heal(strength);
                Destroy(this.gameObject);
                break;

            case Type.DAMAGE:
                PlayerStats.DealDamage(strength);
                Destroy(this.gameObject);
                break;

            case Type.DAMAGE_DIRECT:
                PlayerStats.DealDamage(strength, true);
                Destroy(this.gameObject);
                break;

            case Type.ARMOR:
                PlayerStats.AddArmor(strength);
                Destroy(this.gameObject);
                break;

            case Type.AMMO:
                if (!PlayerStats.IsAmmoFull())
                {
                    PlayerStats.AddAmmo((int)strength);
                    Destroy(this.gameObject);
                }
                break;

            case Type.DOCUMENT:
                PlayerStats.Win();
                Destroy(this.gameObject);
                break;

            default: break;
            }
        }
    }