Пример #1
0
        public void OnWindowGUI()
        {
            var trg = (MapGenerator)target;

            EditorGUI.BeginChangeCheck();

            DrawDefaultInspector();

            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();

            if (GUILayout.Button(generate, EditorStyles.miniButtonLeft, miniButtonWidth))
            {
                trg.GenerateLevel();
            }

            if (GUILayout.Button(createPrefab, EditorStyles.miniButtonMid, miniButtonWidth))
            {
                trg.CreatePrefab();
            }

            if (GUILayout.Button(clear, EditorStyles.miniButtonRight, miniButtonWidth))
            {
                trg.Clean();
            }
            GUILayout.FlexibleSpace();

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();

            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                if (win == null)
                {
                    win = (LMGEditorWindow)EditorWindow.GetWindow(typeof(LMGEditorWindow));
                }
                setUp = (MapGeneratorSetUp)serializedObject.FindProperty("setUp").objectReferenceValue;
                if (setUp != null)
                {
                    win.SetTexture((Texture2D)setUp.editorGeneratorLevel);
                }
            }

            EditorUtility.SetDirty(trg);
        }
Пример #2
0
        void CreateMapSetUp()
        {
            MapGeneratorSetUp asset = ScriptableObject.CreateInstance <MapGeneratorSetUp> ();

            AssetDatabase.CreateAsset(asset, "Assets/New Map Generator Set Up.asset");

            AssetDatabase.SaveAssets();

            map.setUp = asset;

            EditorUtility.FocusProjectWindow();

            Selection.activeObject = asset;
        }
Пример #3
0
 void PoolNumber()
 {
     setUp  = transform.parent.gameObject.GetComponent <InGameMapGenerator> ().GetSetUp();
     length = setUp.GetTotal();
 }