Exemplo n.º 1
0
    void OnTriggerEnter(Collider _Col)
    {
        if (_Col.gameObject.tag == "EBullet" || _Col.gameObject.tag == "Enemy")
        {
            m_Health -= 1;
            if (m_Health <= 0)
            {
                m_Spawner.SetSpawned(false);
                Destroy(gameObject);
            }
        }

        else if (_Col.gameObject.tag == "PBullet")
        {
            m_Health -= 2;
            if (m_Health <= 0)
            {
                m_Spawner.SetSpawned(false);
                //Object type check
                if (gameObject.tag == "SpeedUp")
                {
                    m_BulletSpawn.SetQuadFire(true);
                }
                else if (gameObject.tag == "SpeedDown")
                {
                    m_BulletSpawn.SetQuadFire(false);
                }
                else if (gameObject.tag == "Bomb")
                {
                    m_Bomb.IncreaseBombs(1);
                }
                else if (gameObject.tag == "Health")
                {
                    m_lives.IncreaseLives(1);
                }
                Destroy(gameObject);
            }
        }
    }