public IStronghold CreateStronghold(uint id, string name, byte level, uint x, uint y, decimal gate, int gateMax, string themeId) { IStronghold stronghold; var actionWorker = actionWorkerFactory.CreateActionWorker(null, new SimpleLocation(LocationType.Stronghold, id)); var troopManager = troopManagerFactory.CreateTroopManager(); var notificationManager = notificationManagerFactory.CreateNotificationManager(actionWorker); stronghold = new Stronghold(id, name, level, x, y, gate, gateMax, themeId, kernel.Get <IDbManager>(), notificationManager, troopManager, actionWorker, kernel.Get <Formula>()); // TODO: Remove circular dependency actionWorker.LockDelegate = () => stronghold; troopManager.BaseStation = stronghold; return(stronghold); }
public ICity CreateCity(uint id, IPlayer owner, string name, Position position, ILazyResource resource, byte radius, decimal ap, string defaultTheme, string roadTheme, string wallTheme, string troopTheme) { var worker = actionWorkerFactory.CreateActionWorker(() => owner, new SimpleLocation(LocationType.City, id)); var notifications = notificationManagerFactory.CreateCityNotificationManager(worker, id, owner.PlayerChannel); var references = referenceManagerFactory.CreateReferenceManager(id, worker, owner); var technologies = technologyManagerFactory.CreateTechnologyManager(EffectLocation.City, id, id); var troops = troopManagerFactory.CreateTroopManager(); var template = unitTemplateFactory.CreateUnitTemplate(id); var troopStubFactory = new CityTroopStubFactory(kernel); var city = new City(id, owner, name, position, resource, radius, ap, defaultTheme, roadTheme, troopTheme, wallTheme, worker, notifications, references, technologies, troops, template, troopStubFactory, kernel.Get <IDbManager>(), kernel.Get <IGameObjectFactory>(), kernel.Get <IActionFactory>(), kernel.Get <BattleProcedure>()); // TODO: We should figure a cleaner way so we dont need to have this circular dependency troops.BaseStation = city; troopStubFactory.City = city; return(city); }