示例#1
0
    void OnTriggerEnter(Collider other)
    {
        points pp        = GameObject.FindWithTag("Points").GetComponent <points> ();
        float  oldPoints = pp.getPoints();
        float  newPoints = oldPoints + 150;

        pp.setPoints(newPoints);
    }
示例#2
0
 void OnCollisionEnter(Collision collision)
 {
     if (!hasCollided)
     {
         if (collision.gameObject.name == "Bowling Ball" || collision.gameObject.tag == "Pin")
         {
             GameObject aa = GameObject.FindWithTag("Points");
             points     bb = aa.GetComponent <points> ();
             float      cc = bb.getPoints();
             cc = cc + 10;
             bb.setPoints(cc);
             hasCollided = true;
         }
     }
 }