Ejemplo n.º 1
0
 private void Team_Swap(Collider other)
 {
     if (other.gameObject.name == "Blue Team (1)" && _team != 1)
     {
         if (_team == 2)
         {
             PongManager.Instance.nbPlayerRed--;
         }
         _team    = 1;
         _massPos = GameObject.Find("Mass" + _team).GetComponent <Mass_Pong>();
         this.GetComponent <MeshRenderer>().material = GameObject.Find("Mass" + _team).GetComponent <MeshRenderer>().material;
         PongManager.Instance.nbPlayerBlue++;
     }
     else if (other.gameObject.name == "Red Team (2)" && _team != 2)
     {
         if (_team == 1)
         {
             PongManager.Instance.nbPlayerBlue--;
         }
         _team    = 2;
         _massPos = GameObject.Find("Mass" + _team).GetComponent <Mass_Pong>();
         this.GetComponent <MeshRenderer>().material = GameObject.Find("Mass" + _team).GetComponent <MeshRenderer>().material;
         this.GetComponent <BoxCollider>().isTrigger = true;
         PongManager.Instance.nbPlayerRed++;
     }
 }
Ejemplo n.º 2
0
 private void Awake()
 {
     if (_team != 0)
     {
         _massPos = GameObject.Find("Mass" + _team).GetComponent <Mass_Pong>();
     }
     else
     {
         _massPos = null;
     }
 }