コード例 #1
0
    /*
     * OnInspectorGUI
     * virtual function override
     *
     * this overrides the default inspector for or MapEditorScript allowing
     * for our own custome buttons to be displayed there
     *
     * @returns nothing
     */
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        MapEditorScript myScript = (MapEditorScript)target;

        //adds in a button to generate a default map
        //of normal tiles when clicked
        if (GUILayout.Button("Generate base Map"))
        {
            myScript.GenerateBasMap();
        }

        //this button calls a function in MapEditorScript to toggle on and off paint mode
        if (GUILayout.Button("Toggle paint mode"))
        {
            myScript.TogglePaint();
        }

        //these buttons will only display if paint mode is on
        if (myScript.enablePaint)
        {
            if (GUILayout.Button("Slect Empty"))
            {
                myScript.SetPaintTypeEmptyTile();
            }

            if (GUILayout.Button("Slect Floor"))
            {
                myScript.SetPaintTypeFloorTile();
            }

            if (GUILayout.Button("Slect Wall"))
            {
                myScript.SetPaintTypeWALLTile();
            }

            if (GUILayout.Button("Slect Door"))
            {
                myScript.SetPaintTypeDoorTile();
            }

            if (GUILayout.Button("Slect Wall Font"))
            {
                myScript.SetPaintTypeWALLFONTTile();
            }
        }
    }
コード例 #2
0
    /*
     * OnInspectorGUI
     * virtual function override
     *
     * this overrides the default inspector for or MapEditorScript allowing
     * for our own custome buttons to be displayed there
     *
     * @returns nothing
     */
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        MapEditorScript myScript = (MapEditorScript)target;

        //adds in a button to generate a default map
        //of normal tiles when clicked
        if (GUILayout.Button("Generate base Map"))
        {
            myScript.GenerateBasMap();
        }

        //this button will call a function to make a simple 5,5 chunk of tiles
        if (GUILayout.Button("Generate Map Chunk"))
        {
            myScript.GenerateMapChunk();
        }

        //this button calls a function in MapEditorScript to toggle on and off paint mode
        if (GUILayout.Button("Toggle paint mode"))
        {
            myScript.TogglePaint();
        }

        //this will go through a map and update its tiles with the latest tile prefab
        if (GUILayout.Button("Update Tile Prefab"))
        {
            myScript.UpdateTilePrefabs();
        }

        //these buttons will only display if paint mode is on
        if (myScript.enablePaint)
        {
            //this paints all the tiles as one specific tile on the chossen map
            if (GUILayout.Button("Paint All"))
            {
                myScript.PaintAll();
            }

            //allows you to paint normal tiles on a map
            if (GUILayout.Button("Slect Normal"))
            {
                myScript.SetPaintTypeNormalTile();
            }

            //allows you to paint damage tiles on a map
            if (GUILayout.Button("Slect Damage"))
            {
                myScript.SetPaintTypeDamageTile();
            }

            //allows you to paint Defense tiles on a map
            if (GUILayout.Button("Slect Defense"))
            {
                myScript.SetPaintTypeDefenseTile();
            }

            //allows you to paint impassible tiles on a map
            if (GUILayout.Button("Slect Impassable"))
            {
                myScript.SetPaintTypeImpassibleTile();
            }
        }
    }