public RoamingLogic(IActor actor, ISectorMap map, IActorManager actors, IDecisionSource decisionSource, ITacticalActUsageService actService) : base(actor, map, actors, decisionSource, actService) { }
public MonsterActorTaskSource(IBotPlayer player, IDecisionSource decisionSource, ITacticalActUsageService actService, ISectorManager sectorManager, IActorManager actorManager) : this((IPlayer)player, decisionSource, actService, sectorManager, actorManager) { }
public async Task SetUpAsync() { _map = await SquareMapFactory.CreateAsync(10); var playerMock = new Mock <IPlayer>(); _player = playerMock.Object; var actorMock = new Mock <IActor>(); actorMock.SetupGet(x => x.Node).Returns(() => _factActorNode); actorMock.Setup(x => x.MoveToNode(It.IsAny <IMapNode>())) .Callback <IMapNode>(node => _factActorNode = node); actorMock.SetupGet(x => x.Owner).Returns(_player); _actor = actorMock.Object; // Маршрут из 3-х точек var patrolRoute3PointsMock = new Mock <IPatrolRoute>(); var route3Points = new IMapNode[] { _map.Nodes.OfType <HexNode>().SelectBy(1, 1), _map.Nodes.OfType <HexNode>().SelectBy(5, 3), _map.Nodes.OfType <HexNode>().SelectBy(3, 5) }; patrolRoute3PointsMock .SetupGet(x => x.Points) .Returns(route3Points); _patrolRoute3Points = patrolRoute3PointsMock.Object; // Маршрут из 2-х точек по диагонали комнаты var patrolRoute2DiagonalPointsMock = new Mock <IPatrolRoute>(); var route2DiagonalPoints = new IMapNode[] { _map.Nodes.OfType <HexNode>().SelectBy(0, 0), _map.Nodes.OfType <HexNode>().SelectBy(9, 9) }; patrolRoute2DiagonalPointsMock .SetupGet(x => x.Points) .Returns(route2DiagonalPoints); _patrolRoute2DiagonalPoints = patrolRoute2DiagonalPointsMock.Object; var actors = new List <IActor> { _actor }; var actorListMock = new Mock <IActorManager>(); actorListMock.SetupGet(x => x.Items).Returns(actors); _actorList = actorListMock.Object; var decisionSourceMock = new Mock <IDecisionSource>(); decisionSourceMock.Setup(x => x.SelectIdleDuration(It.IsAny <int>(), It.IsAny <int>())) .Returns(ExpectedIdleDuration); _decisionSource = decisionSourceMock.Object; }
public NextTurnCommand(IGameLoop gameLoop, ISectorManager sectorManager, IPlayerState playerState, IDecisionSource decisionSource) : base(gameLoop, sectorManager, playerState) { _decisionSource = decisionSource; }
public PatrolLogic(IActor actor, IPatrolRoute patrolRoute, ISectorMap map, IActorManager actors, IDecisionSource decisionSource, ITacticalActUsageService actService) : base(actor, map, actors, decisionSource, actService) { _patrolRoute = patrolRoute; }
protected MoveLogicStateBase(IDecisionSource decisionSource, ISectorManager sectorManager) { if (sectorManager is null) { throw new ArgumentNullException(nameof(sectorManager)); } DecisionSource = decisionSource ?? throw new ArgumentNullException(nameof(decisionSource)); Map = sectorManager.CurrentSector.Map; }
protected MonsterActorTaskSource(IPlayer player, IDecisionSource decisionSource, ITacticalActUsageService actService, ISectorManager sectorManager, IActorManager actorManager) { _logicDict = new Dictionary <IActor, IBotLogic>(); _player = player; _decisionSource = decisionSource; _actService = actService; _sectorManager = sectorManager; _actorManager = actorManager; }
public RoamingLogic(IActor actor, IMap map, IActorManager actors, IDecisionSource decisionSource, ITacticalActUsageService actService) { _actor = actor; _map = map; _actorList = actors; _decisionSource = decisionSource; _actService = actService; _persuitCounter = PERSIUT_COUNTER; }
public IdleTask(IActor actor, IActorTaskContext context, IDecisionSource decisionSource) : base(actor, context) { if (actor is null) { throw new ArgumentNullException(nameof(actor)); } if (decisionSource is null) { throw new ArgumentNullException(nameof(decisionSource)); } _counter = decisionSource.SelectIdleDuration(IDLE_MIN, IDLE_MAX); }
protected AgressiveLogicBase(IActor actor, ISectorMap map, IActorManager actorManager, IDecisionSource decisionSource, ITacticalActUsageService actService) { Actor = actor; Map = map; DecisionSource = decisionSource; _actorManager = actorManager; _actService = actService; _pursuitCounter = PursuitCounter; }
public IdleTask(IActor actor, IDecisionSource decisionSource) : base(actor) { if (actor is null) { throw new System.ArgumentNullException(nameof(actor)); } if (decisionSource is null) { throw new System.ArgumentNullException(nameof(decisionSource)); } _counter = decisionSource.SelectIdleDuration(_idleMin, _idleMax); }
public IdleTask(IActor actor, IDecisionSource decisionSource) : base(actor) { _counter = decisionSource.SelectIdleDuration(IDLE_MIN, IDLE_MAX); }
public ExploreLogicState(IDecisionSource decisionSource) : base(decisionSource) { }
protected MoveLogicStateBase(IDecisionSource decisionSource) { DecisionSource = decisionSource ?? throw new ArgumentNullException(nameof(decisionSource)); }
public IdleTask(IActor actor, IDecisionSource decisionSource) : base(actor) { _counter = decisionSource.SelectIdleDuration(IdleMin, IdleMax); }
public ExploreLogicState(IDecisionSource decisionSource, ISectorManager sectorManager) { _decisionSource = decisionSource ?? throw new ArgumentNullException(nameof(decisionSource)); _map = sectorManager.CurrentSector.Map; }
public void GetCurrentTask_2TurnWaiting_ContinueBypassAfterWaiting() { // ARRANGE const int doudleIdleDuration = 2; _factActorNode = _map.Nodes.OfType <HexNode>().SelectBy(1, 1); _map.HoldNode(_factActorNode, _actor); var expectedActorPositions = new IMapNode[] { _map.Nodes.OfType <HexNode>().SelectBy(2, 2), _map.Nodes.OfType <HexNode>().SelectBy(2, 3), _map.Nodes.OfType <HexNode>().SelectBy(3, 3), _map.Nodes.OfType <HexNode>().SelectBy(4, 3), _map.Nodes.OfType <HexNode>().SelectBy(5, 3), _map.Nodes.OfType <HexNode>().SelectBy(5, 3), _map.Nodes.OfType <HexNode>().SelectBy(5, 3), _map.Nodes.OfType <HexNode>().SelectBy(4, 3), _map.Nodes.OfType <HexNode>().SelectBy(4, 4), _map.Nodes.OfType <HexNode>().SelectBy(3, 5), _map.Nodes.OfType <HexNode>().SelectBy(3, 5), _map.Nodes.OfType <HexNode>().SelectBy(3, 5), _map.Nodes.OfType <HexNode>().SelectBy(3, 4), _map.Nodes.OfType <HexNode>().SelectBy(2, 3), _map.Nodes.OfType <HexNode>().SelectBy(2, 2), _map.Nodes.OfType <HexNode>().SelectBy(1, 1), _map.Nodes.OfType <HexNode>().SelectBy(1, 1), _map.Nodes.OfType <HexNode>().SelectBy(1, 1), }; var tacticalActUsageService = CreateTacticalActUsageService(); var decisionSourceMock = new Mock <IDecisionSource>(); decisionSourceMock.Setup(x => x.SelectIdleDuration(It.IsAny <int>(), It.IsAny <int>())) .Returns(doudleIdleDuration); _decisionSource = decisionSourceMock.Object; var logic = new PatrolLogic(_actor, _patrolRoute3Points, _map, _actorList, _decisionSource, tacticalActUsageService); // ACT for (var round = 0; round < expectedActorPositions.Length + 1; round++) { var task = logic.GetCurrentTask(); // ASSERT task.Should().NotBeNull(); switch (round) { case 5: case 6: case 10: case 11: case 16: case 17: task.Should().BeOfType <IdleTask>($"На {round} итерации ожидается задача на простой."); break; default: task.Should().BeOfType <MoveTask>($"На {round} итерации ожидается задача на перемещение."); break; } task.Execute(); if (round < expectedActorPositions.Length) { _factActorNode.Should().Be(expectedActorPositions[round], $"На {round} итерации неожиданные координаты актёра."); } else { _factActorNode.Should().Be(expectedActorPositions[0], $"На {round} итерации актёр должен начать маршрут заново."); } } }
public ExploreLogicState(IDecisionSource decisionSource, ISectorManager sectorManager) : base(decisionSource, sectorManager) { }
public RoamingLogicState(IDecisionSource decisionSource, ISectorManager sectorManager) : base(decisionSource, sectorManager) { }
public void SetUp() { _map = new TestGridGenMap(); var playerMock = new Mock <IPlayer>(); _player = playerMock.Object; var enemyPlayerMock = new Mock <IPlayer>(); var enemyPlayer = enemyPlayerMock.Object; var actorMock = new Mock <IActor>(); actorMock.SetupGet(x => x.Node).Returns(() => _factActorNode); actorMock.Setup(x => x.MoveToNode(It.IsAny <IMapNode>())) .Callback <IMapNode>(node => _factActorNode = node); actorMock.SetupGet(x => x.Owner).Returns(_player); _actor = actorMock.Object; var personMock = new Mock <IPerson>(); var person = personMock.Object; actorMock.SetupGet(x => x.Person).Returns(person); var tacticalActCarrierMock = new Mock <ITacticalActCarrier>(); var tacticalActCarrier = tacticalActCarrierMock.Object; personMock.SetupGet(x => x.TacticalActCarrier).Returns(tacticalActCarrier); var actMock = new Mock <ITacticalAct>(); actMock.SetupGet(x => x.Stats).Returns(new TacticalActStatsSubScheme { Range = new Range <int>(1, 1) }); var act = actMock.Object; tacticalActCarrierMock.SetupGet(x => x.Acts).Returns(new[] { act }); var intruderMock = new Mock <IActor>(); intruderMock.SetupGet(x => x.Owner).Returns(enemyPlayer); intruderMock.SetupGet(x => x.Node).Returns(() => _factIntruderNode); intruderMock.Setup(x => x.MoveToNode(It.IsAny <IMapNode>())) .Callback <IMapNode>(node => _factIntruderNode = node); _intruder = intruderMock.Object; var intruderStateMock = new Mock <IActorState>(); intruderStateMock.SetupGet(x => x.IsDead).Returns(false); var intruderState = intruderStateMock.Object; intruderMock.SetupGet(x => x.State).Returns(intruderState); var actors = new List <IActor> { _actor, _intruder }; var actorListMock = new Mock <IActorManager>(); actorListMock.SetupGet(x => x.Items).Returns(actors); _actorList = actorListMock.Object; var decisionSourceMock = new Mock <IDecisionSource>(); decisionSourceMock.Setup(x => x.SelectIdleDuration(It.IsAny <int>(), It.IsAny <int>())) .Returns(_expectedIdleDuration); _decisionSource = decisionSourceMock.Object; }
public IdleLogicState(IDecisionSource decisionSource) { _decisionSource = decisionSource; }
public HumanActorTaskSource(IDecisionSource decisionSource) { _decisionSource = decisionSource; }
public async System.Threading.Tasks.Task SetUpAsync() { _map = await SquareMapFactory.CreateAsync(10); var playerMock = new Mock <IPlayer>(); _player = playerMock.Object; var enemyPlayerMock = new Mock <IPlayer>(); var enemyPlayer = enemyPlayerMock.Object; var actorMock = new Mock <IActor>(); actorMock.SetupGet(x => x.Node).Returns(() => _factActorNode); actorMock.Setup(x => x.MoveToNode(It.IsAny <IMapNode>())) .Callback <IMapNode>(node => _factActorNode = node); actorMock.SetupGet(x => x.Owner).Returns(_player); _actor = actorMock.Object; var personMock = new Mock <IPerson>(); var person = personMock.Object; actorMock.SetupGet(x => x.Person).Returns(person); var tacticalActCarrierMock = new Mock <ITacticalActCarrier>(); var tacticalActCarrier = tacticalActCarrierMock.Object; personMock.SetupGet(x => x.TacticalActCarrier).Returns(tacticalActCarrier); var actMock = new Mock <ITacticalAct>(); actMock.SetupGet(x => x.Stats).Returns(new TestTacticalActStatsSubScheme()); var act = actMock.Object; tacticalActCarrierMock.SetupGet(x => x.Acts).Returns(new[] { act }); var intruderPersonMock = new Mock <IPerson>(); var intruderPerson = intruderPersonMock.Object; var intruderSurvivalMock = new Mock <ISurvivalData>(); intruderSurvivalMock.SetupGet(x => x.IsDead).Returns(false); var intruderSurvival = intruderSurvivalMock.Object; intruderPersonMock.SetupGet(x => x.Survival).Returns(intruderSurvival); var intruderMock = new Mock <IActor>(); intruderMock.SetupGet(x => x.Owner).Returns(enemyPlayer); intruderMock.SetupGet(x => x.Node).Returns(() => _factIntruderNode); intruderMock.Setup(x => x.MoveToNode(It.IsAny <IMapNode>())) .Callback <IMapNode>(node => _factIntruderNode = node); intruderMock.SetupGet(x => x.Person).Returns(intruderPerson); _intruder = intruderMock.Object; var actors = new List <IActor> { _actor, _intruder }; var actorListMock = new Mock <IActorManager>(); actorListMock.SetupGet(x => x.Items).Returns(actors); _actorList = actorListMock.Object; var decisionSourceMock = new Mock <IDecisionSource>(); decisionSourceMock.Setup(x => x.SelectIdleDuration(It.IsAny <int>(), It.IsAny <int>())) .Returns(ExpectedIdleDuration); _decisionSource = decisionSourceMock.Object; }
public RoamingLogicState(IDecisionSource decisionSource) : base(decisionSource) { }