Level definition


The loading and saving of the level is handled by a custom editor, which uses two text files for that.

One file (the one seen on the top) defines the basic layout of the level and the loader script uses a mapping between prefabs and the characters used in this file to know which object to instantiate.

The other file (the one seen on the bottom) has custom attributes for the gameobjects that need it, currently only the guards use this feature to persist their rotation. Each gameobject that needs to save/load custom data implements an interface and the level loader calls the interface methods when needed.

Each "tile" of the level fits in a 3x3 (Unity units) cube. 

Comments

Log in with itch.io to leave a comment.

Awesome. Why not have all in the same file? Adding a header to separate the custom attributes from the map, or some text data format like json to organize the file would do.

Yes, that would be better! This implementation grew out of a series of patches glued together