Ejemplo n.º 1
0
 void OnCollisionEnter(Collision col)
 {
     if (m_hitSomething == false)
     {
         DartField dartField = col.gameObject.GetComponent <DartField>();
         GetComponent <Rigidbody>().isKinematic = true;
         m_hitSomething = true;
         //m_rotator.enabled=true;
         if (dartField)
         {
             BaseGameManager.dartHitBoard(dartField.score,
                                          dartField.fieldType);
         }
     }
 }
Ejemplo n.º 2
0
 //iterate through all the children of the dart board and add a dart field.
 void Start()
 {
     m_fields = new Vector3[20];
     for (int i = 0; i < transform.childCount; i++)
     {
         DartField df = transform.GetChild(i).gameObject.AddComponent <DartField>();
         if (df.fieldType == DartField.FieldType.TRIPLE)
         {
             BoxCollider bc    = df.gameObject.AddComponent <BoxCollider>();
             int         index = ((df.score) / 3) - 1;
             m_fields[index] = bc.center;
             //				Debug.Log ("index" + index);
             Destroy(bc);
         }
     }
 }