Beispiel #1
0
 void CreateMap()
 {
     currentTile = TileCacher.Instance.Get(1);
     for (int i = 0; i < height; i++)
     {
         for (int j = 0; j < width; j++)
         {
             GameObject obj = Object.Instantiate(prefabTile);
             obj.SetActive(true);
             obj.name = "Tile_" + (i + 1) + "_" + (j + 1);
             obj.transform.SetParent(tilesLayer.transform);
             obj.transform.localPosition = new Vector3(j * 0.64f + 0.32f, -i * 0.64f - 0.32f, 0f);
             obj.transform.localScale    = Vector3.one;
             VTile vTile = obj.GetComponent <VTile>();
             vTile.EditorSetData(currentTile);
         }
     }
 }
Beispiel #2
0
        public void OnClickTile(VTile vTile)
        {
            Vector2Int coordinate = vTile.coordinate;

            vTile.EditorSetData(currentTile);
        }