Ejemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         Restarter.CallGameOver();
         return;
     }
 }
Ejemplo n.º 2
0
        void OnTriggerEnter2D(Collider2D other)
        {
            if (other.tag == "Player")
            {
                //freezes the game
                //Debug.Break ();
                Restarter.CallGameOver();
                return;
            }

            if (other.gameObject.transform.parent)
            {
                Destroy(other.gameObject.transform.parent.gameObject);
            }
            else
            {
                Destroy(other.gameObject);
            }
        }
Ejemplo n.º 3
0
        void OnTriggerEnter2D(Collider2D other)
        {
            if (other.tag == "Player")
            {
                var player        = GameObject.Find("BrocolisPlayer").GetComponent <PlatformerCharacter2D>();
                var chomping      = player.getChomping();
                var britadeirando = player.getBritadeirando();

                if (chomping && britadeirando)
                {
                    print("card eaten");
                    GameObject.Find("Main Camera").GetComponent <HUDScript>().IncreaseScore(100);
                    GameObject.Find("Crash").GetComponent <AudioSource>().Play();
                    Instantiate(ironExplosion, transform.position, Quaternion.identity);
                    Destroy(this.gameObject);
                }
                else
                {
                    Restarter.CallGameOver();
                    return;
                }
            }
        }