/// <summary> /// Obtém a posição do tile informando o setor, a linha e a coluna desejada /// </summary> /// <param name="sector">O setor informado.</param> /// <param name="row">A linha desejada.</param> /// <param name="column">A coluna desejada.</param> public Vector2 GetPosition(Point sector, int row, int column) { Point point = GetPoint(sector, row, column); IsoTile tile = GetTile(point.X, point.Y); return(tile.Actor.Transform.Position); }
/// <summary> /// Inicializa uma nova instância de Tile como cópia de outra instância de Tile. /// </summary> /// <param name="source">A instância de origem.</param> public IsoTile(IsoTile source) { //Actor = source.Actor; Actor = Util.Clone(source.Actor, source.Actor); MapPoint = source.MapPoint; Value = source.Value; }
private void ReadFinalMap() { IsRead = false; Tiles.Clear(); //dimensões do array int d0 = TotalMap.GetLength(0); int d1 = TotalMap.GetLength(1); for (int row = 0; row < d0; row++) { for (int col = 0; col < d1; col++) { //O valor da posição no array T index = TotalMap[row, col]; //Recebe o Tile da tabela Dictionary <T, IsoTile> table = point_sector[new Point(row, col)].Table; if (table.ContainsKey(index)) { IsoTile tile = new IsoTile(table[index]); //largura e altura para cálculo //int w = tile.Animation.Bounds.Width; //int h = tile.Animation.Bounds.Height; int w = TileWidth; int h = TileHeight; float sx = StartPosition.X; float sy = StartPosition.Y; //O cálculo se dá na animação do topo //com o valor de row positivo o mapa fica invertido tile.Actor.Transform.X = ((w / 2) * -row) + ((w / 2) * col) + sx; tile.Actor.Transform.Y = ((h / 2) * col) - ((h / 2) * -row) + sy; tile.UpdateBounds(); tile.MapPoint = new Point(row, col); Tiles.Add(new Point(row, col), tile); } } } IsRead = true; }
/// <summary> /// Obtém a posição do tile informando a linha e a coluna no mapa total. /// </summary> /// <param name="row"></param> /// <param name="column"></param> /// <returns></returns> public Vector2 GetPosition(int row, int column) { IsoTile tile = GetTile(row, column); return(tile.Actor.Transform.Position); }