Пример #1
0
        public IBLOCKS Create(
            PositiveInt value)
        {
            IBLOCKS parameter = null;

            try
            {
                parameter = new BLOCKS(
                    value);
            }
            catch (Exception exception)
            {
                this.Log.Error(
                    exception.Message,
                    exception);
            }

            return(parameter);
        }
    void OnGUI()
    {
        EditorGUILayout.BeginHorizontal();

        _birdsOps = (BIRDS)EditorGUILayout.EnumPopup("", _birdsOps);
        if (GUILayout.Button("Create Bird", GUILayout.Width(80), GUILayout.Height(20)))
        {
            CreateBird(_birdsOps.ToString());
        }

        EditorGUILayout.EndVertical();

        // Pigs section
        EditorGUILayout.BeginHorizontal();

        _pigsOps = (PIGS)EditorGUILayout.EnumPopup("", _pigsOps);

        if (GUILayout.Button("Create Pig", GUILayout.Width(80), GUILayout.Height(20)))
        {
            GameObject pig = InstantiateGameObject(ABWorldAssets.PIGS[_pigsOps.ToString()]);
            pig.transform.parent = GameObject.Find("Blocks").transform;
        }

        EditorGUILayout.EndVertical();

        // Blocks section
        EditorGUILayout.BeginHorizontal();

        _blocksOps = (BLOCKS)EditorGUILayout.EnumPopup("", _blocksOps);
        _material  = (MATERIALS)EditorGUILayout.EnumPopup("", _material);

        if (GUILayout.Button("Create Block", GUILayout.Width(80), GUILayout.Height(20)))
        {
            GameObject block = InstantiateGameObject(ABWorldAssets.BLOCKS[_blocksOps.ToString()]);
            block.transform.parent = GameObject.Find("Blocks").transform;

            BlockEditor.UpdateBlockMaterial(block.GetComponent <ABBlock>(), _material);
        }

        EditorGUILayout.EndHorizontal();

        if (GUILayout.Button("Create Platform"))
        {
            GameObject platform = InstantiateGameObject(ABWorldAssets.PLATFORM);
            platform.transform.parent = GameObject.Find("Platforms").transform;
        }

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("Load Level"))
        {
            LoadLevel();
        }

        if (GUILayout.Button("Save Level"))
        {
            SaveLevel();
        }

        if (GUILayout.Button("Delete Level"))
        {
            if (EditorUtility.DisplayDialog("Delete Level",
                                            "Are you sure you want to delete this level?", "Yes", "Cancel"))
            {
                CleanLevel();
            }
        }

        if (GUILayout.Button("New Level"))
        {
            if (EditorUtility.DisplayDialog("Create New Level",
                                            "Are you sure you want to create a new level? This operation will " +
                                            "not save the current level in the scene", "Yes", "Cancel"))
            {
                CleanLevel();

                Vector3    landscapePos = ABWorldAssets.LANDSCAPE.transform.position;
                GameObject landscape    = InstantiateGameObject(ABWorldAssets.LANDSCAPE);
                landscape.transform.position = landscapePos;
                landscape.transform.parent   = GameObject.Find("GameWorld").transform;

                Vector3    backgroundPos = ABWorldAssets.BACKGROUND.transform.position;
                GameObject background    = InstantiateGameObject(ABWorldAssets.BACKGROUND);
                background.transform.position = backgroundPos;
                background.transform.parent   = GameObject.Find("Camera").transform;

                GameObject slingshot = InstantiateGameObject(ABWorldAssets.SLINGSHOT);
                slingshot.transform.position = ABConstants.SLING_STANDARD_POS;
                slingshot.transform.parent   = GameObject.Find("GameWorld").transform;

                GameObject.Find("Camera").GetComponent <ABGameplayCamera> ()._maxWidth = ABConstants.CAMERA_STANDARD_MAX_WIDTH;
                GameObject.Find("Camera").GetComponent <ABGameplayCamera> ()._minWidth = ABConstants.CAMERA_STANDARD_MIN_WIDTH;
            }
        }



        EditorGUILayout.EndHorizontal();
    }
Пример #3
0
    void OnGUI()
    {
        EditorGUILayout.BeginHorizontal();

        _birdsOps = (BIRDS)EditorGUILayout.EnumPopup("", _birdsOps);
        if (GUILayout.Button("Create Bird", GUILayout.Width(80), GUILayout.Height(20)))
        {
            CreateBird(_birdsOps.ToString());
        }

        EditorGUILayout.EndVertical();

        // Pigs section
        EditorGUILayout.BeginHorizontal();

        _pigsOps = (PIGS)EditorGUILayout.EnumPopup("", _pigsOps);

        if (GUILayout.Button("Create Pig", GUILayout.Width(80), GUILayout.Height(20)))
        {
            GameObject pig = InstantiateGameObject(_pigs[_pigsOps.ToString()]);
            pig.transform.parent = GameObject.Find("Blocks").transform;
        }

        EditorGUILayout.EndVertical();

        // Blocks section
        EditorGUILayout.BeginHorizontal();

        _blocksOps = (BLOCKS)EditorGUILayout.EnumPopup("", _blocksOps);
        _material  = (MATERIALS)EditorGUILayout.EnumPopup("", _material);

        if (GUILayout.Button("Create Block", GUILayout.Width(80), GUILayout.Height(20)))
        {
            GameObject block = InstantiateGameObject(_blocks[_blocksOps.ToString()]);
            block.transform.parent = GameObject.Find("Blocks").transform;

            BlockEditor.UpdateBlockMaterial(block.GetComponent <ABBlock>(), _material);
        }

        EditorGUILayout.EndHorizontal();

        if (GUILayout.Button("Create Platform"))
        {
            GameObject platform = InstantiateGameObject(_platform);
            platform.transform.parent = GameObject.Find("Platforms").transform;
        }

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("Load Level"))
        {
            LoadLevel();
        }

        if (GUILayout.Button("New Level"))
        {
            if (EditorUtility.DisplayDialog("Create New Level",
                                            "Are you sure you want to create a new level? This operation will " +
                                            "not save the current level in the scene", "Yes", "Cancel"))
            {
                CleanLevel();
            }
        }

        if (GUILayout.Button("Save Level"))
        {
            SaveLevel();
        }

        EditorGUILayout.EndHorizontal();
    }