Exemple #1
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll != null)
     {
         Lead lead = coll.gameObject.GetComponent <Lead>();
         if (lead != null)
         {
             lead.NewCoal();
             GameObject trainobj = GameObject.Find("Train");
             Train      train    = trainobj.GetComponent <Train> ();
             train.CreateCoal();
             Destroy(this.gameObject);
         }
     }
 }