public void RebuildEmpty() { transform.position = Vector3.zero; transform.rotation = Quaternion.identity; List <Transform> killList = new List <Transform> (); foreach (Transform t in gameObject.transform) { killList.Add(t); } for (int i = 0; i < killList.Count; ++i) { GameObject.DestroyImmediate(killList[i].gameObject); } _tiles.Clear(); for (int y = 0; y < m_height; ++y) { for (int x = 0; x < m_width; ++x) { bool isBorder = x == 0 || y == 0 || x == m_width - 1 || y == m_height - 1; Vector3 pos = new Vector3(x, 0, y); TileHub prefab = isBorder ? m_prefabs[m_borderPrefab] : m_prefabs[m_centerPrefab]; TileHub th = GameObject.Instantiate(prefab, pos, Quaternion.identity) as TileHub; th.transform.SetParent(transform); _tiles.Add(th); } } }
public void OnInit(TileHub host) { // _host = host; _editRenderer.enabled = false; CfgFrog fc = host.Prog.GetFrogConfigByIndex(m_frogType); FrogHub fh = GameObject.Instantiate(fc.m_prefab, transform) as FrogHub; host.State.m_activeFrogs.Add(new FrogController(fh)); }
public void ReplaceTile(int x, int y, int prefabIndex) { int index = y * m_width + x; DestroyImmediate(_tiles [y * m_width + x].gameObject); Vector3 pos = new Vector3(x, 0, y); TileHub prefab = m_prefabs[prefabIndex]; TileHub th = GameObject.Instantiate(prefab, pos, Quaternion.identity) as TileHub; th.transform.SetParent(transform); _tiles[index] = th; }
public void OnInit(TileHub host) { // _host = host; _editRenderer.enabled = false; if (host.State.m_girlController != null) { Debug.LogError("2 GIRLS???? FREAK OUT!"); } else { GirlHub gh = GameObject.Instantiate(host.Prog.GetGeneralConfig().m_girlPrefab, transform) as GirlHub; host.State.m_girlController = new GirlController(gh); } }
// private TileHub _host; public void OnInit(TileHub host) { // _host = host; }