private void SetNextPaddle()
 {
     if (this.FreePaddles.Count == 0 && this._nextPaddle != null)
         this._nextPaddle = null;
     else
     {
         IList<Paddle> paddlesLeft = (from p in this.FreePaddles where p.RowSide == RowTiltController.RowSide.Left select p).ToList();
         IList <Paddle> paddlesRight = (from p in this.FreePaddles where p.RowSide == RowTiltController.RowSide.Right select p).ToList();
         if (paddlesLeft.Count < paddlesRight.Count)
             this._nextPaddle = paddlesRight[Random.Range(0, paddlesRight.Count)];
         else if (paddlesLeft.Count > paddlesRight.Count)
             this._nextPaddle = paddlesLeft[Random.Range(0, paddlesLeft.Count)];
         else
             this._nextPaddle = this.FreePaddles[Random.Range(0, this.FreePaddles.Count)];
     }
 }
Ejemplo n.º 2
0
 // Use this for initialization
 private void Start()
 {
     _paddle             = GameObject.FindObjectOfType <Paddle>();
     _paddleToBallVector = transform.position - _paddle.transform.position;
 }
 public void AssignPlayer(PhotonRoeier player)
 {
     Paddle nextPaddle = this.NextPaddle;
     player.PaddleViewId = nextPaddle.gameObject.GetPhotonView().viewID;
     this._paddles.Remove(nextPaddle);
     this._nextPaddle = null;
 }