예제 #1
0
 // Update is called once per frame
 void Update()
 {
     for (int i = 0; i < 11; i++)
     {
         rw = obj.list[list2[i]].GetComponent <RedWin>();
         if (rw == null)
         {
             //do nothing
         }
         else
         {
             Panel.SetActive(true);
             Winningmessage.text = "Red Won!";
             rw = null;
         }
         bw = obj.list[list1[i]].GetComponent <BlueWin>();
         if (bw == null)
         {
             //do nothing
         }
         else
         {
             Panel.SetActive(true);
             Winningmessage.text = "Blue Won!";
             bw = null;
         }
     }
 }
예제 #2
0
 // Update is called once per frame
 void Update()
 {
     for (int i = 0; i < obj.list.Length; i++)
     {
         //check if neighbours are blue and prepare a list of blue neighbours
         if (Vector3.Distance(this.transform.position, obj.list[i].transform.position) < 2 && (obj.list[i].GetComponent <Renderer>().material.color == Color.blue) && obj.list[i].name != this.name)
         {
             if (!n.Contains(obj.list[i]))
             {
                 n.Add(obj.list[i]);
             }
         }
     }
     //assign blue win script to neighbouring the blue hex game objects
     for (int i = 0; i < n.Count; i++)
     {
         BlueWin rw = n[i].GetComponent <BlueWin>();
         if (rw == null)
         {
             n[i].AddComponent(typeof(BlueWin));
         }
         else
         {
         }
     }
 }
예제 #3
0
 // Update is called once per frame
 void Update()
 {
     for (int i = 0; i < 11; i++)
     {
         if (gameObjectListManager.list[list2[i]].GetComponent <Renderer>().material.color == Color.blue)
         {
             BlueWin rw = gameObjectListManager.list[list2[i]].GetComponent <BlueWin>();
             if (rw == null)
             {
                 gameObjectListManager.list[list2[i]].AddComponent(typeof(BlueWin));
             }
             else
             {
             }
         }
     }
 }