void OnGUI() { GUILayout.Label("Level Structure", EditorStyles.boldLabel); if (GUILayout.Button("Create New Tilemap")) { CreateNewTileMap(); } EditorGUILayout.Separator(); GUILayout.Label("Level Design", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); if (GUILayout.Button("New Moving Platform")) { CreateMovingPlatform(); } if (GUILayout.Button("New Checkpoint")) { CreateCheckpoint(); } if (GUILayout.Button("New Boss Zone")) { CreateBossZone(); } GUILayout.EndHorizontal(); EditorGUILayout.Separator(); GUILayout.Label("Enemies", EditorStyles.boldLabel); genericGroupEnabled = EditorGUILayout.Foldout(genericGroupEnabled, "Generic Enemies"); if (genericGroupEnabled) { GUILayout.BeginHorizontal(); SelectedGenericEnemy = (GenericEnemyTypesEnum)EditorGUILayout.EnumPopup(SelectedGenericEnemy); if (GUILayout.Button("Create " + SelectedGenericEnemy, GUILayout.Height(20))) { CreateGenericEnemy(SelectedGenericEnemy); } GUILayout.EndHorizontal(); } gluttonyGroupEnabled = EditorGUILayout.Foldout(gluttonyGroupEnabled, "Gluttony Enemies"); if (gluttonyGroupEnabled) { GUILayout.BeginHorizontal(); SelectedGluttonyEnemy = (GluttonyEnemyTypesEnum)EditorGUILayout.EnumPopup(SelectedGluttonyEnemy); if (GUILayout.Button("Create " + SelectedGluttonyEnemy, GUILayout.Height(20))) { CreateGluttonyEnemy(SelectedGluttonyEnemy); } GUILayout.EndHorizontal(); } }
void CreateGluttonyEnemy(GluttonyEnemyTypesEnum enemyType) { GameObject enemyPrefab = null; switch (enemyType) { case GluttonyEnemyTypesEnum.Bouncer: enemyPrefab = Resources.Load <GameObject>("Enemies/Gluttony/Bouncer"); break; case GluttonyEnemyTypesEnum.JumpStack: enemyPrefab = Resources.Load <GameObject>("Enemies/Gluttony/Jump Stack"); break; case GluttonyEnemyTypesEnum.Shotgun: enemyPrefab = Resources.Load <GameObject>("Enemies/Gluttony/Shotgun"); break; case GluttonyEnemyTypesEnum.Runner: enemyPrefab = Resources.Load <GameObject>("Enemies/Gluttony/Runner"); break; case GluttonyEnemyTypesEnum.Thrower: enemyPrefab = Resources.Load <GameObject>("Enemies/Gluttony/Thrower"); break; } Camera sceneCamera = SceneView.lastActiveSceneView.camera; Vector3 spawnPos = new Vector3(sceneCamera.transform.position.x, sceneCamera.transform.position.y, 0); if (enemyPrefab != null) { GameObject obj = GameObject.Instantiate(enemyPrefab, spawnPos, Quaternion.identity); Selection.activeGameObject = obj; } }