OndrejNepozitek / Edgar-Unity

Unity Procedural Level Generator
https://ondrejnepozitek.github.io/Edgar-Unity/docs/introduction
MIT License
817 stars 70 forks source link

Custom room on LevelGraph #63

Closed geuks closed 4 years ago

geuks commented 4 years ago

Hi, i'm trying to do the same as your Enter The Dungeon exemple wich is adding a custom room in Level Graph.

Capture

How do you do that ? I tried to create my own custom Level Graph but it didn't work as i want to. Can you help me ? thanks. (I have pro version)

OndrejNepozitek commented 4 years ago

Hey! This is currently on my list of features that need to be documented.

You have to create a class that implements from the Room class. In the Enter the Gungeon example, it is done like this:

public class GungeonRoom : Room
{
    public GungeonRoomType Type;

    public override string ToString()
    {
        return Type.ToString();
    }
}

After that, when you create a level graph and select it in the inspector, you should be able to choose which room type should be used for the graph. And there you have to choose your new room implementation from the dropdown.

image

However, it seems like there was some merge problem which made it impossible to choose a different room type than the default type. This should be now fixed and a new version was added to itch.io

P.S. You should be able to add various additional fields to your custom room, not just the type. It should work as long as Unity is able to serialize it.

geuks commented 4 years ago

Thanks, it works now !