Exemplo n.º 1
0
    public void PositionChanged(Soldier source)
    {
        if (!mapSetter.TileOnMap(source.soldierInstance.index))
        {
            return;
        }

        tempTile = mapSetter.GetTileByIndex(source.soldierInstance.index.x, source.soldierInstance.index.y);
        source.transform.position = tempTile.transform.position + (Vector3)(source.soldierInstance.position - Index.ToVector2(tempTile.index)) * tileSize.value;
    }
    public void GetExistsTilesOnTheMap(Index firstIndex, Index lastIndex, ref List <Tile> existsTiles)
    {
        SetFirstIndex(ref firstIndex);
        MapUtils.SetSumValues(firstIndex, lastIndex, out sumX, out sumY);

        for (int i = 0; i <= Mathf.Abs(firstIndex.y - lastIndex.y); i++)
        {
            currentY = firstIndex.y + i * sumY;

            for (int j = 0; j <= Mathf.Abs(firstIndex.x - lastIndex.x); j++)
            {
                currentX = firstIndex.x + j * sumX;

                tempTile = mapSetter.GetTileByIndex(currentX, currentY);
                if (tempTile != null)
                {
                    existsTiles.Add(tempTile);
                }
            }
        }
    }