public WinPlatformBuilder(IConsoleWriter consoleWriter, IGameObjectLocator gameObjectLocator, IGeometryMathService geometryMathService) { _consoleWriter = consoleWriter; _gameObjectLocator = gameObjectLocator; _geometryMathService = geometryMathService; }
public void Lock_ListOfPlayerId_WhenPlayersAreFound_ShouldReturnLockedPlayers( [Frozen] IGameObjectLocator locator, IPlayer player1, IPlayer player2, IPlayer player3, DefaultLocker locker) { IPlayer outPlayer2; locator.TryGetObjects(Arg.Is <uint>(id => id >= 1 && id <= 3), out outPlayer2).ReturnsForAnyArgs(call => { call[1] = player1; return(true); }, call => { call[1] = player2; return(true); }, call => { call[1] = player3; return(true); }); Dictionary <uint, IPlayer> lockedPlayers; var multiObjLock = locker.Lock(out lockedPlayers, 1, 2, 3); lockedPlayers.Should().Contain(new KeyValuePair <uint, IPlayer>(1, player1)); lockedPlayers.Should().Contain(new KeyValuePair <uint, IPlayer>(2, player2)); lockedPlayers.Should().Contain(new KeyValuePair <uint, IPlayer>(3, player3)); multiObjLock.Received(1) .Lock(Arg.Is <ILockable[]>(itemsLocked => itemsLocked.SequenceEqual(new[] { player1, player2, player3 }))); }
public void Lock_CityIdTroopId_WhenCityIsFound_ShouldReturnLockedCity( [Frozen] IGameObjectLocator locator, ICity city, ITroopObject troop, DefaultLocker locker) { ICity outCity; locator.TryGetObjects(1, out outCity).Returns(call => { call[1] = city; return(true); }); ITroopObject outTroop; city.TryGetTroop(2, out outTroop).Returns(call => { call[1] = troop; return(true); }); ICity lockedCity; ITroopObject lockedTroop; var multiObjLock = locker.Lock(1, 2, out lockedCity, out lockedTroop); ((object)lockedCity).Should().Be(city); lockedTroop.Should().Be(troop); multiObjLock.Received(1) .Lock(Arg.Is <ILockable[]>(itemsLocked => itemsLocked.SequenceEqual(new[] { city }))); }
public void Lock_ListOfCityId_WhenCitiesAreNotFound_ShouldReturnEmptyLockAndEmptyDictionary( [Frozen] IGameObjectLocator locator, ICity city1, ICity city2, ICity city3, DefaultLocker locker) { ICity outCity2; locator.TryGetObjects(Arg.Is <uint>(id => id >= 1 && id <= 2), out outCity2).ReturnsForAnyArgs(call => { call[1] = city1; return(true); }, call => { call[1] = city2; return(false); }); Dictionary <uint, ICity> lockedCities; var multiObjLock = locker.Lock(out lockedCities, 1, 2); lockedCities.Should().BeNull(); multiObjLock.Received(1) .Lock(Arg.Is <ILockable[]>(itemsLocked => !itemsLocked.Any())); }
public void Lock_ListOfPlayerId_WhenPlayersAreNotFound_ShouldReturnEmptyLockAndEmptyDictionary( [Frozen] IGameObjectLocator locator, IPlayer player1, IPlayer player2, IPlayer player3, DefaultLocker locker) { IPlayer outPlayer2; locator.TryGetObjects(Arg.Is <uint>(id => id >= 1 && id <= 2), out outPlayer2).ReturnsForAnyArgs(call => { call[1] = player1; return(true); }, call => { call[1] = player2; return(false); }); Dictionary <uint, IPlayer> lockedPlayers; var multiObjLock = locker.Lock(out lockedPlayers, 1, 2); lockedPlayers.Should().BeNull(); multiObjLock.Received(1) .Lock(Arg.Is <ILockable[]>(itemsLocked => !itemsLocked.Any())); }
public LaborMoveActiveAction(Formula formula, Procedure procedure, ILocker locker, IGameObjectLocator gameObjectLocator) { this.formula = formula; this.procedure = procedure; this.locker = locker; this.gameObjectLocator = gameObjectLocator; }
public BarbarianTribeBattlePassiveAction(uint barbarianTribeId, ILocker locker, IGameObjectLocator gameObjectLocator, IDbManager dbManager, Formula formula, BarbarianTribeBattleProcedure barbarianTribeBattleProcedure, IWorld world, ISimpleStubGeneratorFactory simpleStubGeneratorFactory) : this(locker, gameObjectLocator, dbManager, formula, barbarianTribeBattleProcedure, world, simpleStubGeneratorFactory) { this.barbarianTribeId = barbarianTribeId; this.locker = locker; this.gameObjectLocator = gameObjectLocator; this.dbManager = dbManager; this.formula = formula; this.barbarianTribeBattleProcedure = barbarianTribeBattleProcedure; this.world = world; IBarbarianTribe barbarianTribe; if (!gameObjectLocator.TryGetObjects(barbarianTribeId, out barbarianTribe)) { throw new Exception("Did not find barb tribe that was supposed to be having a battle"); } simpleStubGenerator = simpleStubGeneratorFactory.CreateSimpleStubGenerator(formula.BarbarianTribeUnitRatios(), formula.BarbarianTribeUnitTypes()); }
public void Lock_CityIdStructureId_WhenCityIsFound_ShouldReturnLockedCity( [Frozen] IGameObjectLocator locator, ICity city, IStructure structure, DefaultLocker locker) { ICity outCity; locator.TryGetObjects(1, out outCity).Returns(call => { call[1] = city; return(true); }); IStructure outStructure; city.TryGetStructure(2, out outStructure).Returns(call => { call[1] = structure; return(true); }); ICity lockedCity; IStructure lockedStructure; var multiObjLock = locker.Lock(1, 2, out lockedCity, out lockedStructure); ((object)lockedCity).Should().Be(city); lockedStructure.Should().Be(structure); multiObjLock.Received(1) .Lock(Arg.Is <ILockable[]>(itemsLocked => itemsLocked.SequenceEqual(new[] { city }))); }
public void Lock_ListOfCityId_WhenCitiesAreFound_ShouldReturnLockedCities( [Frozen] IGameObjectLocator locator, ICity city1, ICity city2, ICity city3, DefaultLocker locker) { ICity outCity2; locator.TryGetObjects(Arg.Is <uint>(id => id >= 1 && id <= 3), out outCity2).ReturnsForAnyArgs(call => { call[1] = city1; return(true); }, call => { call[1] = city2; return(true); }, call => { call[1] = city3; return(true); }); Dictionary <uint, ICity> lockedCities; var multiObjLock = locker.Lock(out lockedCities, 1, 2, 3); lockedCities.Should().Contain(new KeyValuePair <uint, ICity>(1, city1)); lockedCities.Should().Contain(new KeyValuePair <uint, ICity>(2, city2)); lockedCities.Should().Contain(new KeyValuePair <uint, ICity>(3, city3)); multiObjLock.Received(1) .Lock(Arg.Is <ILockable[]>(itemsLocked => itemsLocked.SequenceEqual(new[] { city1, city2, city3 }))); }
public TribeContributeActiveAction(IGameObjectLocator locator, Formula formula, ILocker locker) { this.locator = locator; this.formula = formula; this.locker = locker; }
public CityEngageDefensePassiveAction(BattleProcedure battleProcedure, CityBattleProcedure cityBattleProcedure, IGameObjectLocator gameObjectLocator) { this.battleProcedure = battleProcedure; this.cityBattleProcedure = cityBattleProcedure; this.gameObjectLocator = gameObjectLocator; }
public DefaultLocker(DefaultMultiObjectLock.Factory multiObjectLockFactory, CallbackLock.Factory callbackLockFactory, IGameObjectLocator locator) { this.multiObjectLockFactory = multiObjectLockFactory; this.callbackLockFactory = callbackLockFactory; this.locator = locator; }
public TroopMovePassiveAction(Formula formula, ITileLocator tileLocator, IGameObjectLocator world, ILocker locker) { this.formula = formula; this.tileLocator = tileLocator; this.world = world; this.locker = locker; }
public CityTileNextAvailableLocationStrategy(MapFactory mapFactory, Formula formula, IForestManager forestManager, IGameObjectLocator gameObjectLocator) { this.mapFactory = mapFactory; this.formula = formula; this.forestManager = forestManager; this.gameObjectLocator = gameObjectLocator; }
public EnemyInputAggroState(IGameObjectLocator gameObjectLocator, IGeometryMathService geometryMathService, EnemyData enemyData) { _gameObjectLocator = gameObjectLocator; _geometryMathService = geometryMathService; _enemyData = enemyData; _approachingDistance = enemyData.ApproachingDistance; _playerLoseDistance = enemyData.PlayerLoseDistance; }
public EnemyInputComponent(IGameObjectLocator gameObjectLocator, IGeometryMathService geometryMathService, EnemyData enemyData) { _enemyState = new EnemyInputIdleState(gameObjectLocator, geometryMathService, enemyData); _gameObjectLocator = gameObjectLocator; _geometryMathService = geometryMathService; _enemyData = enemyData; }
public EnemyBuilder(IConsoleWriter consoleWriter, IGameObjectLocator gameObjectLocator, IGeometryMathService geometryMathService, IGameCommand fireCommand, EnemyData enemyData) { _consoleWriter = consoleWriter; _gameObjectLocator = gameObjectLocator; _geometryMathService = geometryMathService; _fireCommand = fireCommand; _enemyData = enemyData; }
public StrongholdEngageGateAttackPassiveAction(IBattleFormulas battleFormula, IGameObjectLocator gameObjectLocator, StrongholdBattleProcedure strongholdBattleProcedure, IDbManager dbManager, IStaminaMonitorFactory staminaMonitorFactory) { this.battleFormula = battleFormula; this.gameObjectLocator = gameObjectLocator; this.strongholdBattleProcedure = strongholdBattleProcedure; this.dbManager = dbManager; this.staminaMonitorFactory = staminaMonitorFactory; }
public ObjectRemovePassiveAction(IGameObjectLocator gameObjectLocator, ILocker locker, Procedure procedure, CallbackProcedure callbackProcedure, IDbManager dbmanager) { this.gameObjectLocator = gameObjectLocator; this.locker = locker; this.procedure = procedure; this.callbackProcedure = callbackProcedure; this.dbmanager = dbmanager; }
public EnemyLogicComponent(IGameObjectLocator gameObjectLocator, IGameCommand fireCommand, IGeometryMathService geometryMathService, EnemyData enemyData) { _enemyState = new EnemyLogicNormalState(gameObjectLocator, fireCommand, geometryMathService, enemyData); _gameObjectLocator = gameObjectLocator; _fireCommand = fireCommand; _geometryMathService = geometryMathService; _enemyData = enemyData; }
public AssignmentCommandsModule(BattleProcedure battleProcedure, IGameObjectLocator gameObjectLocator, ILocker locker, IStrongholdManager strongholdManager, ICityManager cityManager) { this.battleProcedure = battleProcedure; this.gameObjectLocator = gameObjectLocator; this.locker = locker; this.strongholdManager = strongholdManager; this.cityManager = cityManager; }
public EnemyLogicNormalState(IGameObjectLocator gameObjectLocator, IGameCommand fireCommand, IGeometryMathService geometryMathService, EnemyData enemyData) { _gameObjectLocator = gameObjectLocator; _fireCommand = fireCommand; _geometryMathService = geometryMathService; _enemyData = enemyData; _updatesForReload = enemyData.UpdatesForReload; _currentUpdatesForReload = 0; }
public BarbarianTribeAttackChainAction(IActionFactory actionFactory, Procedure procedure, ILocker locker, IGameObjectLocator gameObjectLocator, BattleProcedure battleProcedure) { this.actionFactory = actionFactory; this.procedure = procedure; this.locker = locker; this.gameObjectLocator = gameObjectLocator; this.battleProcedure = battleProcedure; }
public CityEngageDefensePassiveAction(uint cityId, uint troopObjectId, FormationType formationType, BattleProcedure battleProcedure, CityBattleProcedure cityBattleProcedure, IGameObjectLocator gameObjectLocator) : this(battleProcedure, cityBattleProcedure, gameObjectLocator) { this.cityId = cityId; this.troopObjectId = troopObjectId; this.formationType = formationType; }
public TribeContributeActiveAction(uint cityId, uint structureId, Resource resource, IGameObjectLocator locator, Formula formula, ILocker locker) : this(locator, formula, locker) { this.cityId = cityId; this.structureId = structureId; this.resource = new Resource(resource); }