Exemplo n.º 1
0
    //Столкневение с другим объектом
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "GameBoundary" || other.tag == "Shield" || other.tag == "Ammo" || other.tag == "WingSupport")
        {
            return;
        }
        if (other.tag == "Asteroid" && gameObject.transform.position.z > 10f)
        {
            return;
        }

        if (other.tag != "Player" && other.tag != "PlayerShield" && other.tag != "Boss")
        {
            Destroy(other.gameObject);
        }
        else if (other.tag == "Player")
        {
            gameControllerScript.DecreaseLives();
        }

        if (other.tag == "PlayerShield")
        {
            Destroy(this.gameObject);
            gameControllerScript.LoseShields();
            gameControllerScript.LazerManfunction();
        }



        //Destroy(other.gameObject);

        Destroy(this.gameObject);

        Instantiate(asteroidExplosion, transform.position, Quaternion.identity);

        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, Quaternion.identity);
        }

        if (other.tag == "Lazer")
        {
            gameControllerScript.IncreaseScore(10);
            Destroy(other.gameObject);
            Destroy(this.gameObject);
        }

        if (other.tag == "Ally")
        {
            Instantiate(playerExplosion, other.transform.position, Quaternion.identity);
            Destroy(other.gameObject);
            Destroy(this.gameObject);
            Instantiate(downedAlly, other.transform.position, Quaternion.identity);
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Lazer" || other.tag == "Ally")
        {
            Instantiate(asteroidExplosion, other.transform.position, Quaternion.identity);
            Destroy(other.gameObject);
            DecreaseBossHull();
            Instantiate(asteroidExplosion, other.transform.position, Quaternion.identity);
        }

        if (other.tag == "PlayerShield")
        {
            gameControllerScript.LoseShields();
            gameControllerScript.LazerManfunction();
            DecreaseBossHull();
            Instantiate(asteroidExplosion, other.transform.position, Quaternion.identity);
        }

        if (other.tag == "Player")
        {
            gameControllerScript.DecreaseLives();
            DecreaseBossHull();
            Instantiate(asteroidExplosion, other.transform.position, Quaternion.identity);
        }

        if (other.tag == "Asteroid")
        {
            DecreaseBossHull();
            Destroy(other.gameObject);
            Instantiate(asteroidExplosion, other.transform.position, Quaternion.identity);
        }

        if (other.tag == "GameBoundary" || other.tag == "Shield" || other.tag == "Ammo" || other.tag == "WingSupport" ||
            other.tag == "EnemyLazer")
        {
            return;
        }
    }