public void Show9Grid() { // int width = (int)(ar_width / MAXGRID); // if (ar_width % MAXGRID != 0) // { // width++; // } // // int height = (int)(ar_height / MAXGRID); // if (ar_height % MAXGRID != 0) // { // height++; // } GameObject terrainRoot = GameObject.Find("9Grids"); if (terrainRoot != null) { GameObject.Destroy(terrainRoot); } terrainRoot = new GameObject("9Grids"); uint gridWidth = (uint)GameCmd.GameCmdConst.SCREEN_GRID_WIDTH; TerrainBlock.GRID_NUM = gridWidth; GridDef.GridSize = gridWidth; m_9GridLayer = new _9GridLayer(terrainRoot.transform); m_9GridLayer.Create(ar_width / gridWidth, ar_height / gridWidth); m_9GridLayer.RefreshGridColor(); if (terrainRoot.GetComponent <MapAreaRoot>() == null) { terrainRoot.AddComponent <MapAreaRoot>().Init(ar_width, ar_width, m_strFilePath); } }
public void Hide9Grid() { m_9GridLayer = null; GameObject terrainRoot = GameObject.Find("9Grids"); if (terrainRoot != null) { GameObject.Destroy(terrainRoot); } }