Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Tile
- {
- short typeId;
- public TileType Type
- {
- get
- {
- return TileType.Get(typeId);
- }
- set
- {
- typeId = value.Id;
- }
- }
- }
- class TileType
- {
- //you may want to encapsulate these
- public int Id;
- public string Name;
- public Texture2D Texture;
- public Rectangle TextureSource;
- public bool IsObstacle;
- static List<TileType> types;
- static TileType()
- {
- types = new List<TileType>();
- var type = new TileType();
- type.Name = "Dirt";
- //initialize here
- types.Add(type);
- }
- public static TileType Get(int id)
- {
- return types[id];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment