示例#1
0
 /**
  * This function handles the collision detection of the Circle objects.
  * This function is called when a collision with a Triangle object is detected.
  * Handles removal of both Circle and Triangle objects and adds to the score.
  * @param obj the object that collided with the Circle
  */
 public void OnTriggerEnter2D(Collider2D obj)
 {
     if (obj.gameObject.name == "Triangle(Clone)") //! If there are triangles present...
     {
         Destroy(obj.gameObject);                  //! Triangles must be capable of destroying our squares.
         Destroy(gameObject);
         managerScript.AddScore(5);
     }
 }