Ejemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        EditorGUILayout.Separator();

        DungeonBuilder dungeon = (DungeonBuilder)target;

        room.position = EditorGUILayout.Vector3Field("Room position", room.position);
        room.size     = EditorGUILayout.Vector2Field("Room size", room.size);

        if (GUILayout.Button("Create room"))
        {
            dungeon.CreateRoomGameObject(room);
        }

        var seed      = dungeon.seed;
        var radius    = dungeon.radius;
        var roomCount = dungeon.roomCount;

        if (GUILayout.Button("Create rooms"))
        {
            clearRooms(dungeon);
            dungeon.BuildDungeon(radius, seed, roomCount);
        }

        if (GUILayout.Button("Clear rooms"))
        {
            clearRooms(dungeon);
        }
    }