public void OnTileSelected(BoardTile tile) { if(!tile.IsEmpty()) { GoToMainActionMenu(); //Change the menu to Move, Attack, Defense, etc Bug selectedBug = tile.GetBug(); PopulateStatsTexts(selectedBug); //Populate the texts on the StatsPanel } else { HideAllButtons(); } }
//Called when the tile 'tile' is selected. This method spreads the event to all the ITileListeners public void OnTileSelected(BoardTile tile) { if (selectedTile == tile) //When clicking on a selected tile, unselect it { selectedTile.OnUnSelected(); selectedTile = null; board.GetCanvasManager().OnTileUnSelected(tile); } else //Tile selected for the first time { if (selectedTile != null) selectedTile.OnUnSelected(); //Tell the last selected tile that its not selected anymore selectedTile = tile; selectedTile.OnSelected(); //Tell the selected tile that its been selected selectedBug = selectedTile.GetBug(); if (selectedBug != null) //If the tile isnt empty, do something with the bug { if(currentGameState == BoardGameState.Pointing) { /*Just mark the selected tile, i.e., do nothing here*/ } else if(currentGameState == BoardGameState.MovingBug) { //When a tile is selected and the player is moving } } board.GetCanvasManager().OnTileSelected(tile); } }