Exemple #1
0
    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();
        }
    }
Exemple #2
0
    void CreateGenericEnemy(GenericEnemyTypesEnum enemyType)
    {
        GameObject enemyPrefab = null;

        switch (enemyType)
        {
        case GenericEnemyTypesEnum.Bouncer:
            enemyPrefab = Resources.Load <GameObject>("Enemies/Generic/Bouncer");
            break;

        case GenericEnemyTypesEnum.JumpStack:
            enemyPrefab = Resources.Load <GameObject>("Enemies/Generic/Jump Stack");
            break;

        case GenericEnemyTypesEnum.Launcher:
            enemyPrefab = Resources.Load <GameObject>("Enemies/Generic/Launcher");
            break;

        case GenericEnemyTypesEnum.Runner:
            enemyPrefab = Resources.Load <GameObject>("Enemies/Generic/Runner");
            break;

        case GenericEnemyTypesEnum.Thrower:
            enemyPrefab = Resources.Load <GameObject>("Enemies/Generic/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;
        }
    }