Esempio n. 1
0
    private void SetUpTiles()
    {
        var tilemap = GetComponentInChildren <Tilemap>();
        var tile    = TileLoader.GetBasicTile();

        randomNum = Random.Range(1, _maps.Count - 1);

        var mapSize = _maps[randomNum].mapSize;
        var columns = mapSize.First();
        var rows    = mapSize.Last();

        tilemap.gameObject.transform.position = new Vector3(-columns / 2, -rows / 2);


        for (int i = 0; i < rows; i++)
        {
            for (int j = 0; j < columns; j++)
            {
                Vector3Int pos = new Vector3Int(i, j, 0);
                tilemap.SetTile(pos, tile);
            }
        }


        generateEnemyPathEvent.Invoke(rows, columns, -columns / 2, -rows / 2);
    }