Пример #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Powerup"))
        {
            DefinePowerup pow             = other.gameObject.GetComponent <DefinePowerup>();
            DefinePowerup.ePowerupType pt = pow.GetTypeOfPowerup();
            if (pt == DefinePowerup.ePowerupType.Health)
            {
                health += 25;
                if (health > 100)
                {
                    health = 100;
                }

                if (!inSpecialMode)
                {
                    LoseApproval();
                }

                if (isAI)
                {
                    aiMangr.gotPowerup = true;
                }
            }
            else if (pt == DefinePowerup.ePowerupType.Relic)
            {
                if (!inSpecialMode)
                {
                    health -= 10;
                    if (health < 0)
                    {
                        health = 0;
                    }
                    GainApproval();
                }

                if (isAI)
                {
                    aiMangr.gotPowerup = true;
                }
            }
            pow.PlayPowerupSound();
            Destroy(other.gameObject);
        }
    }