Okay, so I have a dictionary of types int and Tile. I have a class called TileManager that I'm designing to return a NEW instance of a certain tile. Right now this is what I have.
public class TileManager
{
private Dictionary<int, Tile> _registeredTiles = new Dictionary<int, Tile>();
public Tile GetNewTile(int id)
{
// Here, I need to return a new instance of the tile at the given key. I want
// something like this: return new _registeredTiles[id].GetType();
}
. . .
}
The problem is, I can't just create a new Tile class, because it will be holding different classes other than tiles (it will be holding children of Tile).