public void UI_GenerateMap() { if (LastMap) { Destroy(LastMap); } m_NoOccupyList.Clear(); m_OccupyList.Clear(); var map = new MoenenGames.FleckMapGenerator.FleckMap() { Bump = 0.1f, }; map.Generate(64, 64); LastMap = map.SpawnToScene(null, Ground); for (int i = 0; i < map.AllGroundPointList.Count; i++) { m_NoOccupyList.Add(map.AllGroundPointList[i]); } for (int i = 0; i < BirthCount; i++) { int randomIndex = Random.Range(0, m_NoOccupyList.Count); Vector3 point = m_NoOccupyList[randomIndex]; GameObject g = Object.Instantiate(BirthPoint); g.name = "Birth" + i; g.transform.SetParent(map.RootPoint.transform); g.transform.position = new Vector3(point.x, point.y + 1 / 2.0f, point.z); g.transform.localRotation = Quaternion.identity; g.transform.localScale = Vector3.one; m_NoOccupyList.Remove(point); m_OccupyList.Add(point); } }
public void UI_GenerateMap() { if (LastMap) { Destroy(LastMap); } var map = new MoenenGames.FleckMapGenerator.FleckMap() { Bump = 0.1f }; map.Generate(64, 64); LastMap = map.SpawnToScene(null, Ground); }