Exemplo n.º 1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.GetComponent <BallComp>())
        {
            if (explosion)
            {
                var particles = Instantiate(explosion, transform.position, Quaternion.identity);
                Destroy(particles, 1.0f);
            }
            controller.DestroyObj(this.gameObject);

            if (!controller.activeBonus)
            {
                --controller.numLifes;

                controller.UpdateValueLifes();

                if (controller.numLifes <= 0)
                {
                    //Destroy(collision.gameObject);
                    //Invoke("Reset", controller.waitTime);
                    //controller.PauseGame(true);
                    collision.gameObject.SetActive(false);
                    controller.ResetGame(collision.gameObject);
                }
                //else
                //{
                //    (gameObject.GetComponent(typeof(Collider)) as Collider).isTrigger = true;
                //}
            }
        }
    }
Exemplo n.º 2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <BallComp>())
        {
            ++controller.numLifes;

            controller.UpdateValueLifes();

            Destroy(gameObject);
        }
    }