public Tile GenerateNewTile(string typeName, TileState state, Vector2D pos, Direction dir = Direction.North) { Type tileType = Type.GetType("SS14.Client.Services.Tiles." + typeName, false); if (tileType == null) { throw new ArgumentException("Invalid Tile Type specified : '" + typeName + "' ."); } RectangleF rect = new RectangleF(); Tile created; if (typeName != "Wall") { rect = new RectangleF(pos.X, pos.Y, TileSpacing, TileSpacing); } else { if (dir == Direction.North) { rect = new RectangleF(pos.X, pos.Y, wallThickness, TileSpacing); } else { rect = new RectangleF(pos.X, pos.Y, TileSpacing, wallThickness); } } if (typeName == "Wall") { created = (Tile)Activator.CreateInstance(tileType, state, rect, dir); } else { created = (Tile)Activator.CreateInstance(tileType, state, rect); } created.Initialize(); if (tileType.GetInterface("ICollidable") != null) { _collisionManager.AddCollidable((ICollidable)created); } return(created); }