@@ -18,7 +18,7 @@ public class ModularEditor : Editor{
1818
1919 public ModularSystem modularSystem ;
2020
21- private bool partSetFoldout ;
21+ private bool partSetFoldout = true ;
2222 private List < ReorderableList > partLists = new List < ReorderableList > ( ) ;
2323
2424 private int drawingListIndex ;
@@ -68,7 +68,7 @@ public override void OnInspectorGUI()
6868
6969 if ( GUILayout . Button ( "Randomize seed" ) ) {
7070
71-
71+ modularSystem . randomSeed = GetRandomizeSeed ( ) ;
7272
7373 }
7474
@@ -91,6 +91,29 @@ public override void OnInspectorGUI()
9191 }
9292
9393
94+ // begin area of starting mode
95+
96+ modularSystem . myStartMethod = ( StartingMethod ) EditorGUILayout . EnumPopup ( "Generation Method:" , modularSystem . myStartMethod ) ;
97+
98+
99+ switch ( modularSystem . myStartMethod ) {
100+
101+ case StartingMethod . Awake :
102+
103+ EditorGUILayout . HelpBox ( "Procedural generation will start at the Begining of the game." , MessageType . Info ) ;
104+
105+ break ;
106+
107+ case StartingMethod . OnCall :
108+
109+ EditorGUILayout . HelpBox ( "Procedural generation will be execute when player called [ModuleSystem.StartGenerate] function." , MessageType . Info ) ;
110+
111+ break ;
112+
113+
114+
115+ }
116+
94117 // begin area of part set settings
95118
96119 partSetFoldout = EditorGUILayout . Foldout ( partSetFoldout , "Part set settings" ) ;
@@ -115,6 +138,13 @@ public override void OnInspectorGUI()
115138 ps . name = EditorGUILayout . TextField ( "Part Set Name:" , ps . name ) ;
116139
117140 ps . attachTransform = ( Transform ) EditorGUILayout . ObjectField ( "Attached Transform: " , ps . attachTransform , typeof ( Transform ) , true ) ;
141+
142+ if ( ps . attachTransform && ps . attachTransform . gameObject ) {
143+
144+ if ( ps . name . Contains ( "new Part Set" ) ) ps . name = ps . attachTransform . gameObject . name ;
145+
146+ }
147+
118148
119149 EditorGUILayout . Separator ( ) ;
120150
@@ -126,15 +156,6 @@ public override void OnInspectorGUI()
126156
127157 partLists [ index ] . DoLayoutList ( ) ;
128158
129-
130-
131- // button of new part
132-
133- if ( GUILayout . Button ( "New Part" ) ) {
134-
135- CreateNewPart ( ps ) ;
136-
137- }
138159
139160
140161
@@ -182,7 +203,15 @@ public override void OnInspectorGUI()
182203
183204 public int GetRandomizeSeed ( ) {
184205
185- return 0 ;
206+
207+
208+ Random . InitState ( System . DateTime . Now . GetHashCode ( ) ) ;
209+
210+ int seed = Mathf . RoundToInt ( Random . Range ( - 2147483648 , 2147483648 ) ) ;
211+
212+ if ( seed == modularSystem . randomSeed ) seed = GetRandomizeSeed ( ) ;
213+
214+ return seed ;
186215
187216 }
188217
@@ -262,6 +291,8 @@ public void DrawHeader(Rect rect){
262291
263292 public void DrawPartElement ( Rect rect , int index , bool isActive , bool isFocused ) {
264293
294+ // Draw each element in the list
295+
265296 Part p = modularSystem . partSetList [ drawingListIndex ] . partList [ index ] ;
266297
267298 p . name = EditorGUI . TextField ( new Rect ( rect . x + 10 , rect . y + 5 , rect . width - 18 , 15 ) , "Name: " , p . name ) ;
@@ -272,6 +303,7 @@ public void DrawPartElement(Rect rect, int index, bool isActive, bool isFocused)
272303
273304 p . prefab = ( GameObject ) EditorGUI . ObjectField ( new Rect ( rect . x + 10 , rect . y + 110 , rect . width - 18 , 15 ) , "Part Prefab:" , p . prefab , typeof ( GameObject ) , true ) ;
274305
306+ if ( p . prefab && p . name . Contains ( "NewPart" ) ) p . name = p . prefab . name ;
275307 }
276308
277309
0 commit comments