void CreateMap() { GameObject newGo = new GameObject(); newGo.name = this.mapData.map_id.ToString(); // 그라운드를 만든다. GameObject groundPrefab = PrefabsManager.GetInstance().dicGroundPrefabs[mapData.groundName]; Instantiate(groundPrefab).transform.parent = newGo.transform; // 환경을 배치한다. for (int i = 0; i < mapData.listEnvirnment.Count; i++) { GameObject envirGo = PrefabsManager.GetInstance().dicEnvironmentPrefabs[mapData.listEnvirnment[i].name]; Vector3 pos = new Vector3(mapData.listEnvirnment[i].x, mapData.listEnvirnment[i].y, 0); Instantiate(envirGo, pos, Quaternion.identity).transform.parent = newGo.transform; } // 그리드를 생성한다. grid.gridWorldSize = new Vector2(mapData.grid_x, mapData.grid_y); grid.nodeRadius = mapData.node_radius; grid.CreateGrid(); }
void CreateGrid(MapData data) { // Grid 생성 grid.gridWorldSize = new Vector2(data.grid_x, data.grid_y); grid.nodeRadius = data.node_radius; grid.CreateGrid(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); YellowBean.Grid grid = (YellowBean.Grid)target; if (GUILayout.Button("Create Grid")) { grid.CreateGrid(); } }