Exemple #1
0
        /// <summary>
        /// Changes cell material to appropriate textures depending on what cells are selectable by the current player
        /// </summary>
        void Update()
        {
            GameObject hotelTile = Instantiate(hotelTilePrefab) as GameObject;

            hotelTile.GetComponent <HotelTile>().row    = row;
            hotelTile.GetComponent <HotelTile>().column = column;
            hotelTile.transform.localPosition           = new Vector3(-100, -100, -100);
            hotelTile.name = "hotelTile " + row + "," + column;
            HotelTile ht = hotelTile.GetComponent <HotelTile>();

            if (selectable == true && gameManager.playerTurn.hotelTiles.Contains(ht))
            {
                GetComponent <Renderer>().material = selectableMaterial;
            }
            else
            {
                GetComponent <Renderer>().material = baseMaterial;
                GetComponent <Cell>().selectable   = false;
            }
            Destroy(hotelTile);
        }
Exemple #2
0
        /// <summary>
        /// Checks every cell in the board and marks them as selectable if the current player has a tile to place
        /// </summary>
        public void MarkPlayableCells()
        {
            Player currentPlayer = playerTurn;

            for (int row = 0; row < 9; row++)
            {
                for (int column = 0; column < 12; column++)
                {
                    GameObject hotelTile = Instantiate(hotelTilePrefab) as GameObject;
                    hotelTile.GetComponent <HotelTile>().row    = row;
                    hotelTile.GetComponent <HotelTile>().column = column;
                    hotelTile.transform.localPosition           = new Vector3(-100, -100, -100);
                    hotelTile.name = "hotelTile " + row + "," + column;
                    HotelTile ht = hotelTile.GetComponent <HotelTile>();
                    if (currentPlayer.hotelTiles.Contains(ht))
                    {
                        board.cells[row, column].GetComponent <Cell>().selectable = true;
                    }
                    Destroy(hotelTile);
                }
            }
        }