private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.collider.tag == "Virus1")
     {
         /*var explosion = Instantiate(prefabExplosion);
          * explosion.transform.position = this.transform.position;*/
         Destroy(this.gameObject);
         scoringSystem.AddScore(10);
     }
     if (collision.collider.tag == "Virus2")
     {
         /*var explosion = Instantiate(prefabExplosion);
          * explosion.transform.position = this.transform.position;*/
         Destroy(this.gameObject);
         scoringSystem.AddScore(10);
     }
     if (collision.collider.tag == "Virus3")
     {
         /*var explosion = Instantiate(prefabExplosion);
          * explosion.transform.position = this.transform.position;*/
         Destroy(this.gameObject);
         scoringSystem.AddScore(10);
     }
 }
Exemple #2
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "pickable")
     {
         Vegetable v = col.gameObject.GetComponent <Vegetable>();
         if (v)
         {
             print("Delivery");
             v.thrower.playScore(v.vegName);
             int           score = v.score;
             ScoringSystem sb    = (ScoringSystem)ScoreBoard.GetComponent(typeof(ScoringSystem));
             sb.AddScore(score, col.gameObject);
         }
     }
 }