Ejemplo n.º 1
0
 /// <summary>
 /// EventHandler for TilePlaced events.
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">event args</param>
 private void OnTilePlaced(object sender, TriominoTileEventArgs e)
 {
     this.TilesToPlace.Enqueue(e);
     //if (UnityGameManager.instance.GameManager.IsAiPlayer(UnityGameManager.instance.GameManager.ActivePlayer))
     //{
     //    StartCoroutine(WaitUntilReady(e));
     //}
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Coroutine which waits with placing a tile until the board is ready for placing
 /// (previous tiles has to be placed first)
 /// </summary>
 /// <param name="e">event args.</param>
 /// <returns>IEnumerator for coroutine</returns>
 IEnumerator WaitUntilReady(TriominoTileEventArgs e)
 {
     while (!this.isReady)
     {
         yield return(new WaitForSeconds(0.25f));
     }
     this.TryPlaceTileFromDrawBoard(e.Player.Value, e.TileName, e.OtherTileName, e.TileFace, e.OtherTileFAce);
 }
Ejemplo n.º 3
0
    private void Update()
    {
        if (!UnityGameManager.instance.GameManager.CanDrawTile())
        {
            this.DrawButton.GetComponent <DrawButtonManager>().Deactivate();
        }

        if (this.TilesToPlace.Count > 0 && this.isReady)
        {
            TriominoTileEventArgs e = this.TilesToPlace.Dequeue();
            this.TryPlaceTileFromDrawBoard(e.Player.Value, e.TileName, e.OtherTileName, e.TileFace, e.OtherTileFAce);
        }
    }