public TokenClientRepository(IActorManager actorManager) { Verify.IsNotNull(nameof(actorManager), actorManager); _actorManger = actorManager; }
public ActorHandler(IDIContext container) { _actorManager = container.Resolve <IActorManager>(); _memoryManager = container.Resolve <IMemoryReaderManager>(); }
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; }
private static IActor CreateHumanActor(HumanPlayer humanPlayer, ISchemeService schemeService, ISurvivalRandomSource survivalRandomSource, IPropFactory propFactory, ISectorManager sectorManager, IActorManager actorManager) { var personScheme = schemeService.GetScheme <IPersonScheme>("human-person"); var playerActorStartNode = sectorManager.CurrentSector.Map.Regions .SingleOrDefault(x => x.IsStart).Nodes .First(); if (humanPlayer.MainPerson == null) { var inventory = new Inventory(); var evolutionData = new EvolutionData(schemeService); var defaultActScheme = schemeService.GetScheme <ITacticalActScheme>(personScheme.DefaultAct); var person = new HumanPerson(personScheme, defaultActScheme, evolutionData, survivalRandomSource, inventory); humanPlayer.MainPerson = person; // TODO Использовать генератор персонажа, как в игре. // Для этого нужно научить ботов корректно использовать оружие дальнего боя и посохи лечения. var classRoll = new Random().Next(1, 3); switch (classRoll) { case 1: AddEquipmentToActor(person.EquipmentCarrier, 2, "short-sword", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 1, "steel-armor", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 3, "wooden-shield", schemeService, propFactory); break; case 2: AddEquipmentToActor(person.EquipmentCarrier, 2, "battle-axe", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 3, "battle-axe", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 0, "highlander-helmet", schemeService, propFactory); break; case 3: AddEquipmentToActor(person.EquipmentCarrier, 2, "bow", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 1, "leather-jacket", schemeService, propFactory); AddEquipmentToActor(inventory, "short-sword", schemeService, propFactory); AddResourceToActor(inventory, "arrow", 10, schemeService, propFactory); break; case 4: AddEquipmentToActor(person.EquipmentCarrier, 2, "fireball-staff", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 1, "scholar-robe", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 0, "wizard-hat", schemeService, propFactory); AddResourceToActor(inventory, "mana", 15, schemeService, propFactory); break; case 5: AddEquipmentToActor(person.EquipmentCarrier, 2, "pistol", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 0, "elder-hat", schemeService, propFactory); AddResourceToActor(inventory, "bullet-45", 5, schemeService, propFactory); AddResourceToActor(inventory, "packed-food", 1, schemeService, propFactory); AddResourceToActor(inventory, "water-bottle", 1, schemeService, propFactory); AddResourceToActor(inventory, "med-kit", 1, schemeService, propFactory); AddResourceToActor(inventory, "mana", 5, schemeService, propFactory); AddResourceToActor(inventory, "arrow", 3, schemeService, propFactory); break; default: throw new InvalidOperationException("Эта комбинация начальной экипировки не поддерживается."); } AddResourceToActor(inventory, "packed-food", 1, schemeService, propFactory); AddResourceToActor(inventory, "water-bottle", 1, schemeService, propFactory); AddResourceToActor(inventory, "med-kit", 1, schemeService, propFactory); } var actor = new Actor(humanPlayer.MainPerson, humanPlayer, playerActorStartNode); actorManager.Add(actor); return(actor); }
public GameLoop(ISectorManager sectorManager, IActorManager actorManager) { _sectorManager = sectorManager; _actorManager = actorManager; }
private static IActor CreateHumanActor(HumanPlayer humanPlayer, ISchemeService schemeService, ISurvivalRandomSource survivalRandomSource, IPropFactory propFactory, ISectorManager sectorManager, IActorManager actorManager) { var personScheme = schemeService.GetScheme <IPersonScheme>("human-person"); var playerActorStartNode = sectorManager.CurrentSector.Map.Regions .SingleOrDefault(x => x.IsStart).Nodes .First(); if (humanPlayer.MainPerson == null) { var inventory = new Inventory(); var evolutionData = new EvolutionData(schemeService); var defaultActScheme = schemeService.GetScheme <ITacticalActScheme>(personScheme.DefaultAct); var person = new HumanPerson(personScheme, defaultActScheme, evolutionData, survivalRandomSource, inventory); humanPlayer.MainPerson = person; var classRoll = new Random().Next(1, 3); switch (classRoll) { case 1: AddEquipmentToActor(person.EquipmentCarrier, 2, "short-sword", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 1, "steel-armor", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 3, "wooden-shield", schemeService, propFactory); break; case 2: AddEquipmentToActor(person.EquipmentCarrier, 2, "battle-axe", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 3, "battle-axe", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 0, "highlander-helmet", schemeService, propFactory); break; case 3: AddEquipmentToActor(person.EquipmentCarrier, 2, "bow", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 1, "leather-jacket", schemeService, propFactory); AddEquipmentToActor(inventory, "short-sword", schemeService, propFactory); AddResourceToActor(inventory, "arrow", 10, schemeService, propFactory); break; case 4: AddEquipmentToActor(person.EquipmentCarrier, 2, "fireball-staff", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 1, "scholar-robe", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 0, "wizard-hat", schemeService, propFactory); AddResourceToActor(inventory, "mana", 15, schemeService, propFactory); break; case 5: AddEquipmentToActor(person.EquipmentCarrier, 2, "pistol", schemeService, propFactory); AddEquipmentToActor(person.EquipmentCarrier, 0, "elder-hat", schemeService, propFactory); AddResourceToActor(inventory, "bullet-45", 5, schemeService, propFactory); AddResourceToActor(inventory, "packed-food", 1, schemeService, propFactory); AddResourceToActor(inventory, "water-bottle", 1, schemeService, propFactory); AddResourceToActor(inventory, "med-kit", 1, schemeService, propFactory); AddResourceToActor(inventory, "mana", 5, schemeService, propFactory); AddResourceToActor(inventory, "arrow", 3, schemeService, propFactory); break; } AddResourceToActor(inventory, "packed-food", 1, schemeService, propFactory); AddResourceToActor(inventory, "water-bottle", 1, schemeService, propFactory); AddResourceToActor(inventory, "med-kit", 1, schemeService, propFactory); } var actor = new Actor(humanPlayer.MainPerson, humanPlayer, playerActorStartNode); actorManager.Add(actor); return(actor); }
private static IEnumerable <IActor> CheckForIntruders(IActor actor, ISectorMap map, IActorManager actorManager) { foreach (var target in actorManager.Items) { if (target.Person.Fraction == actor.Person.Fraction || (target.Person.Fraction == Fractions.MilitiaFraction && actor.Person.Fraction == Fractions.MainPersonFraction) || (target.Person.Fraction == Fractions.MainPersonFraction && actor.Person.Fraction == Fractions.MilitiaFraction) || (target.Person.Fraction == Fractions.InterventionistFraction && actor.Person.Fraction == Fractions.TroublemakerFraction) || (target.Person.Fraction == Fractions.TroublemakerFraction && actor.Person.Fraction == Fractions.InterventionistFraction)) { continue; } if (target.Person.CheckIsDead()) { continue; } var isVisible = LogicHelper.CheckTargetVisible(map, actor.Node, target.Node); if (!isVisible) { continue; } yield return(target); } }
public TimeActor(ActorKey actorKey, IActorManager actorManager) : base(actorKey, actorManager) { }
public ActorSum(ActorKey actorKey, IActorManager actorManager) : base(actorKey, actorManager) { }
public ActorNode(ActorKey actorKey, IActorManager actorManager) : base(actorKey, actorManager) { }
public StringCache(ActorKey actorKey, IActorManager actorManager) : base(actorKey, actorManager) { }
public IdentityActorRepository(IActorManager actorManager) { Verify.IsNotNull(nameof(actorManager), actorManager); _actorManger = actorManager; }
public RouteManager(IActorManager actorManager) { actorManager.Verify(nameof(actorManager)).IsNotNull(); _actorManager = actorManager; }