using UnityEngine; using System.Collections.Generic; public class Map : MonoBehaviour { public Vector2Int mapSize; public Tile[,] tiles; public List units; private BaseObjects bases; private void Awake() { bases = FindObjectOfType(); //Create the tiles tiles = new Tile[mapSize.x, mapSize.y]; for(int y = 0; y < mapSize.y; y++) { for(int x = 0; x < mapSize.x; x++) { GameObject currentTileObject = Instantiate(bases.baseTile, transform); Tile currentTile = currentTileObject.GetComponent(); tiles[x, y] = currentTile; currentTile.transform.position = new Vector3(x, y); currentTile.position.Position = new MapPosition(x, y); currentTile.Type = bases.tileTypes["Empty"]; //TODO: tilerenderer } } } }