Example #1
0
    void OnTriggerExit2D(Collider2D collision)
    {
        BirdController bird = collision.gameObject.GetComponent <BirdController>();

        if (bird && !bird.IsDead())
        {
            bird.AddScore(1);
        }
    }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     string[] BirdTag = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     for (int i = 0; i < 10; i++)
     {
         if (collision.gameObject.tag == BirdTag[i])
         {
             Tm = GameObject.FindGameObjectWithTag(BirdTag[i]).GetComponent <BirdController>();
             Tm.AddScore();
             //Debug.Log(Tm.tag+" "+Tm.ShowScore());
         }
     }
 }