/// <summary> /// Maybe we should use Reflections at some point. #justsayin /// </summary> /// <param name="interactive"></param> /// <param name="animation"></param> /// <param name="properties"></param> /// <param name="position"></param> /// <returns></returns> public static BasicTile LoadTile(bool interactive, bool animation, TiledProperties properties, Index2 position) { BasicTile result = null; if (interactive && animation) { switch (properties.GetProperty("Type")) { case "CellDoor": //result = new CellDoor("cellDoor", position); //break; case "Door": result = new DoorTile("door", position); break; default: result = new InteractiveTile("door", position); break; } } else if (animation && !interactive) { result = new AnimatedTile("flower", position); } else if (!interactive && !animation) { result = new BasicTile("dirt", position); } else { throw new NotSupportedException("No Tile should be interacitve but not animated"); } result.AddProperties(properties); return(result); }
protected override void LoadTiles(int x, int y, int z, TiledProperties properties, bool interactive, bool animation) { base.LoadTiles(x, y, z, properties, interactive, animation); if (interactive && animation) { switch (properties.GetProperty("Type")) { case "CellDoor": tiles[x, y] = new CellDoor("cellDoor", new Index3(x, y, z), GetLayer(z).DrawOrder); break; } } tiles[x, y].AddProperties(properties); }