private void OnApplicationQuit()
 {
     // Prevent Errors on leaving the game
     ultimateSpawner = null;
 }
Exemple #2
0
        public override void OnInspectorGUI()
        {
            ultimateSpawner = (UltimateSpawner)target;

            serializedObject.Update();

            GUILayout.Label("Basic Settings", EditorStyles.boldLabel);

//			EditorGUILayout.PropertyField(background, new GUIContent("Background Color"));

            ultimateSpawner.objectToSpawn = (GameObject)EditorGUILayout.ObjectField(new GUIContent("Object to Spawn", "Choose an object to spawn"),
                                                                                    ultimateSpawner.objectToSpawn, typeof(GameObject), true);

            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Debug " + (ultimateSpawner.ShowDebugMessages ? "On" : "Off")))
            {
                ultimateSpawner.ShowDebugMessages = !ultimateSpawner.ShowDebugMessages;
            }
            if (GUILayout.Button("Pooling System " + (ultimateSpawner.usePoolSystem ? "On" : "Off")))
            {
                ultimateSpawner.usePoolSystem = !ultimateSpawner.usePoolSystem;
            }
            GUILayout.EndHorizontal();

            // Line Divider
            GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });
            GUILayout.Space(5);

            GUILayout.Label("Spawn Settings", EditorStyles.boldLabel);
            ultimateSpawner.spawnMode =
                (SpawnMode)EditorGUILayout.EnumPopup("Spawn Mode", ultimateSpawner.spawnMode);

            if (ultimateSpawner.spawnMode == SpawnMode.Input)
            {
                GUILayout.Space(10);

                GUILayout.Label("Input Settings", EditorStyles.boldLabel);

                ultimateSpawner.inputKeyCode =
                    (KeyCode)EditorGUILayout.EnumPopup("Input KeyCode", ultimateSpawner.inputKeyCode);

                // Line Divider
                GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });
            }
            else if (ultimateSpawner.spawnMode == SpawnMode.External)
            {
                EditorGUILayout.HelpBox("Currently you can call the public method Spawn() from another script", MessageType.Info, true);

                // Line Divider
                GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });
            }
            else
            {
                ShowTimerSettings();
            }

            ShowPositionSettings();

            ShowRotationSettings();

            ShowMovementSettings();

            ShowPoolSettings();

//			EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());

//			EditorFix.SetObjectDirty(ultimateSpawner);

            serializedObject.ApplyModifiedProperties();

            // Little Fix to Set Scene Dirty if anything has changed
            if (GUI.changed && !Application.isPlaying)
            {
                EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
            }
        }
 // Set UltimateSpawner
 public void SetUltimateSpawner(UltimateSpawner us)
 {
     this.ultimateSpawner = us;
 }