Exemplo n.º 1
0
    void OnTriggerExit(Collider other)
    {
        if (other.tag == "Parachute2")
        {
            position1   = other.transform.position;
            position2.y = position1.y - 0.4f;
            position2.z = position1.z;

            if (position1.x > 0)
            {
                position2.x = position1.x + 0.7f;

                gameControl.Count_left();
                Instantiate(Paratroop, position2, Quaternion.Euler(0, 270, 0));
            }
            else if (position1.x < 0)
            {
                position2.x = position1.x + 2.3f;

                gameControl.Count_right();
                Instantiate(Paratroop, position2, Quaternion.Euler(0, 50, 0));
            }

            gameControl.AddScore(-5);
        }


        Destroy(other.gameObject);
    }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log(other.tag);

        if (other.tag == "Boundary")
        {
            return;
        }


        if (explosion != null && other.tag != "Parachute2" && other.tag != "Attacker" && other.tag != "Bomb" && other.tag != "Destructor")
        {
            Instantiate(explosion, transform.position, transform.rotation);
        }

        if (other.tag == "Player" || other.tag == "Tank" || other.tag == "Shield")
        {
            aud.Play(0);
            // Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            //gameController.GameOver();
            //gameController.AddScore(scoreValue);
            //Destroy(other.gameObject);
            Destroy(gameObject, aud.clip.length / 10);
        }

        else
        {
            if (other.tag == "Enemy")
            {
                aud.Play(0);
                gameController.AddScore(scoreValue);
                Destroy(other.gameObject, aud.clip.length / 10);
                Destroy(gameObject, aud.clip.length / 10);
            }

            if (other.tag == "Destructor")
            {
                aud.Play(0);
                gameController.AddScore(scoreValue);
                Instantiate(explosion, transform.position, transform.rotation);
                //Destroy(other.gameObject);
                Destroy(gameObject, aud.clip.length / 10);
            }

            else if (other.tag == "Zigzag")
            {
                aud.Play(0);
                gameController.AddScore(scoreValue);
                //Destroy(other.gameObject);
                Destroy(gameObject, aud.clip.length / 10);
            }

            else if (other.tag == "Weapon")
            {
                aud.Play(0);
                //gameController.AddScore(scoreValue);
                //Destroy(other.gameObject);
                Instantiate(explosion, transform.position, transform.rotation);
                Destroy(gameObject, aud.clip.length / 10);
            }
        }
    }