void GenerateSeedAndMap(int width = -1, int height = -1) { width = width > 0 ? width : CurrentMapData.Width; height = height > 0 ? height : CurrentMapData.Height; Seeds = FleckMap.GetRandomSeeds(width, height); GenerateMap(width, height); }
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); } }
void NewMapTask() { if (Util.Dialog("", "Create a new map?\nYou will lose the unsaved change.", "Create new", "Cancel")) { GUI.FocusControl(""); EditorApplication.delayCall += () => { CurrentMapData = new FleckMap(); GenerateSeedAndMap(); FreshPreview(); Repaint(); }; } }
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); }