/// <returns> Return a cell with coordinates in matrix and Tile. </returns> private Cell GetSelectionCell(Vector2 position) { Cell cell = PositionConverter.GetCellByClickPosition(position); if (0 <= cell.C && cell.C < matrix.Columns) { if (0 <= cell.R && cell.R < matrix.Rows) { if (matrix[cell] != null) { cell.Tile = matrix[cell]; } else { cell = null; } return(cell); } } return(null); }
public void ChangeState(TileState state) { switch (state) { case TileState.Destroy: { TileState stateBeforeDestroy = this.State; if (Type == TileType.Bomb || Type == TileType.HorizontalLine || Type == TileType.VerticalLine) { stateBeforeDestroy = TileState.Idle; } this.State = TileState.Destroy; Destroying?.Invoke(this, new TileEventArgs(PositionOnScreen, Type, stateBeforeDestroy, PositionConverter.GetCellByTilePosition(PositionOnScreen))); break; } default: { this.State = state; break; } } }