rustbyte/shotgunrobot — pull request #3 by GeorgeValergas (2014-12-01 02:11:23+00:00)
Title: Change 3/3 - Implement Abstract Factory Design Pattern for Mob

MobSpawnerTile objects are responsible for spawning the same Mob type after they’ve been initialized. However, the way this was being done was by using the `mobName` String attribute which indicated what Mob object to create. Instead of using a string variable, The creational logic is moved out of the Mob class and into Mob Factory classes that all extend `MobFactory`.

Each of these Factories has a spawnMob() method that returns a new object of the desired Mob subclass.
This makes it easy to add new MobSpawners to Tile objects. Just create a new Factory for each new Mob and add the factory to any Tile.