Exemplo n.º 1
0
        private static IActor CreateHumanActor(HumanPlayer humanPlayer,
                                               IHumanPersonFactory personFactory,
                                               ISectorManager sectorManager,
                                               IActorManager actorManager,
                                               IPerkResolver perkResolver)
        {
            var person = personFactory.Create();

            Console.WriteLine("Start properties:");
            foreach (var equipment in person.EquipmentCarrier)
            {
                Console.WriteLine($"Equiped: {equipment}");
            }

            foreach (var prop in person.Inventory.CalcActualItems())
            {
                Console.WriteLine(prop);
            }

            humanPlayer.MainPerson = person;

            var playerActorStartNode = sectorManager.CurrentSector.Map.Regions
                                       .SingleOrDefault(x => x.IsStart).Nodes
                                       .First();

            var actor = new Actor(humanPlayer.MainPerson, humanPlayer, playerActorStartNode, perkResolver);

            actorManager.Add(actor);

            return(actor);
        }
Exemplo n.º 2
0
 public MonsterActorTaskSource(IBotPlayer player,
                               IDecisionSource decisionSource,
                               ITacticalActUsageService actService,
                               ISectorManager sectorManager,
                               IActorManager actorManager) : this((IPlayer)player, decisionSource, actService, sectorManager, actorManager)
 {
 }
Exemplo n.º 3
0
 public MoveCommand(
     ISectorManager sectorManager,
     ISectorUiState playerState) :
     base(sectorManager, playerState)
 {
     Path = new List <IGraphNode>();
 }
Exemplo n.º 4
0
 protected ActorCommandBase(IGameLoop gameLoop,
                            ISectorManager sectorManager,
                            ISectorUiState playerState) : base(gameLoop)
 {
     SectorManager = sectorManager;
     PlayerState   = playerState;
 }
Exemplo n.º 5
0
 public MineDepositCommand(
     ISectorManager sectorManager,
     ISectorUiState playerState,
     IMineDepositMethodRandomSource mineDepositMethodRandomSource) : base(sectorManager, playerState)
 {
     _mineDepositMethodRandomSource = mineDepositMethodRandomSource;
 }
Exemplo n.º 6
0
 public MoveCommand(IGameLoop gameLoop,
                    ISectorManager sectorManager,
                    IPlayerState playerState) :
     base(gameLoop, sectorManager, playerState)
 {
     _path = new List <IMapNode>();
 }
Exemplo n.º 7
0
        public GameLoop(ISectorManager sectorManager, IActorTaskSourceCollector actorTaskSourceCollector)
        {
            _taskDict = new ConcurrentDictionary <IActor, TaskState>();

            _sectorManager            = sectorManager ?? throw new ArgumentNullException(nameof(sectorManager));
            _actorTaskSourceCollector = actorTaskSourceCollector ?? throw new ArgumentNullException(nameof(actorTaskSourceCollector));
        }
Exemplo n.º 8
0
 public EquipCommand(IGameLoop gameLoop,
                     ISectorManager sectorManager,
                     ISectorUiState playerState,
                     IInventoryState inventoryState) :
     base(gameLoop, sectorManager, playerState)
 {
     _inventoryState = inventoryState;
 }
 public TacticalActUsageService(
     ITacticalActUsageRandomSource actUsageRandomSource,
     ISectorManager sectorManager,
     IActUsageHandlerSelector actUsageHandlerSelector,
     IEquipmentDurableService equipmentDurableService) : this(actUsageRandomSource, sectorManager, actUsageHandlerSelector)
 {
     EquipmentDurableService = equipmentDurableService ?? throw new ArgumentNullException(nameof(equipmentDurableService));
 }
Exemplo n.º 10
0
 public UseSelfCommand(IGameLoop gameLoop,
                       ISectorManager sectorManager,
                       IPlayerState playerState,
                       IInventoryState inventoryState) :
     base(gameLoop, sectorManager, playerState)
 {
     _inventoryState = inventoryState;
 }
Exemplo n.º 11
0
 public UseSelfCommand(
     ISectorManager sectorManager,
     ISectorUiState playerState,
     IInventoryState inventoryState) :
     base(sectorManager, playerState)
 {
     _inventoryState = inventoryState;
 }
Exemplo n.º 12
0
 public AttackCommand(
     ISectorManager sectorManager,
     ISectorUiState playerState,
     ITacticalActUsageService tacticalActUsageService) :
     base(sectorManager, playerState)
 {
     _tacticalActUsageService = tacticalActUsageService;
 }
Exemplo n.º 13
0
 public AttackCommand(IGameLoop gameLoop,
                      ISectorManager sectorManager,
                      IPlayerState playerState,
                      ITacticalActUsageService tacticalActUsageService) :
     base(gameLoop, sectorManager, playerState)
 {
     _tacticalActUsageService = tacticalActUsageService;
 }
 public DefeatTargetLogicState(ISectorManager sectorManager,
                               ITacticalActUsageService actService,
                               IActorManager actorManager)
 {
     _map          = sectorManager.CurrentSector.Map;
     _actService   = actService ?? throw new ArgumentNullException(nameof(actService));
     _actorManager = actorManager ?? throw new ArgumentNullException(nameof(actorManager));
 }
 /// <summary>
 /// Конструирует экземпляр службы <see cref="TacticalActUsageService"/>.
 /// </summary>
 /// <param name="actUsageRandomSource">Источник рандома для выполнения действий.</param>
 /// <param name="perkResolver">Сервис для работы с прогрессом перков.</param>
 /// <param name="sectorManager">Менеджер сектора.</param>
 /// <exception cref="System.ArgumentNullException">
 /// actUsageRandomSource
 /// or
 /// perkResolver
 /// or
 /// sectorManager
 /// </exception>
 public TacticalActUsageService(ITacticalActUsageRandomSource actUsageRandomSource,
                                IPerkResolver perkResolver,
                                ISectorManager sectorManager)
 {
     _actUsageRandomSource = actUsageRandomSource ?? throw new ArgumentNullException(nameof(actUsageRandomSource));
     _perkResolver         = perkResolver ?? throw new ArgumentNullException(nameof(perkResolver));
     _sectorManager        = sectorManager ?? throw new ArgumentNullException(nameof(sectorManager));
 }
Exemplo n.º 16
0
 public NextTurnCommand(IGameLoop gameLoop,
                        ISectorManager sectorManager,
                        IPlayerState playerState,
                        IDecisionSource decisionSource) :
     base(gameLoop, sectorManager, playerState)
 {
     _decisionSource = decisionSource;
 }
 /// <summary>
 /// Конструирует экземпляр службы <see cref="TacticalActUsageService"/>.
 /// </summary>
 /// <param name="actUsageRandomSource">Источник рандома для выполнения действий.</param>
 /// <param name="perkResolver">Сервис для работы с прогрессом перков.</param>
 /// <param name="sectorManager">Менеджер сектора.</param>
 /// <exception cref="System.ArgumentNullException">
 /// actUsageRandomSource
 /// or
 /// perkResolver
 /// or
 /// sectorManager
 /// </exception>
 public TacticalActUsageService(
     ITacticalActUsageRandomSource actUsageRandomSource,
     ISectorManager sectorManager,
     IActUsageHandlerSelector actUsageHandlerSelector)
 {
     _actUsageRandomSource    = actUsageRandomSource ?? throw new ArgumentNullException(nameof(actUsageRandomSource));
     _sectorManager           = sectorManager ?? throw new ArgumentNullException(nameof(sectorManager));
     _actUsageHandlerSelector = actUsageHandlerSelector ?? throw new ArgumentNullException(nameof(actUsageHandlerSelector));
 }
Exemplo n.º 18
0
        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;
        }
Exemplo n.º 19
0
        public LootLogicState(ISectorManager sectorManager)
        {
            if (sectorManager is null)
            {
                throw new System.ArgumentNullException(nameof(sectorManager));
            }

            _map           = sectorManager.CurrentSector.Map;
            _sectorManager = sectorManager;
        }
Exemplo n.º 20
0
        public MoveCommand(IGameLoop gameLoop,
                           ISectorManager sectorManager,
                           ISectorUiState playerState,
                           IActorManager actorManager) :
            base(gameLoop, sectorManager, playerState)
        {
            _actorManager = actorManager;

            Path = new List <IMapNode>();
        }
Exemplo n.º 21
0
 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 async Task SetUpAsync()
        {
            var actUsageRandomSourceMock = new Mock <ITacticalActUsageRandomSource>();

            actUsageRandomSourceMock.Setup(x => x.RollToHit(It.IsAny <Roll>())).Returns(6);
            actUsageRandomSourceMock.Setup(x => x.RollEfficient(It.IsAny <Roll>())).Returns(1);
            _actUsageRandomSource = actUsageRandomSourceMock.Object;

            _perkResolverMock = new Mock <IPerkResolver>();
            _perkResolver     = _perkResolverMock.Object;

            var personMock = new Mock <IPerson>();

            _person = personMock.Object;

            var evolutionDataMock = new Mock <IEvolutionData>();
            var evolutionData     = evolutionDataMock.Object;

            personMock.SetupGet(x => x.EvolutionData).Returns(evolutionData);

            var actScheme = new TestTacticalActStatsSubScheme
            {
                Offence = new TestTacticalActOffenceSubScheme
                {
                    Type   = OffenseType.Tactical,
                    Impact = ImpactType.Kinetic,
                    ApRank = 10
                }
            };

            var actMock = new Mock <ITacticalAct>();

            actMock.SetupGet(x => x.Stats).Returns(actScheme);
            _act = actMock.Object;

            var sectorManagerMock = new Mock <ISectorManager>();
            var sectorManager     = sectorManagerMock.Object;

            var map = await SquareMapFactory.CreateAsync(3);

            var sectorMock = new Mock <ISector>();

            sectorMock.SetupGet(x => x.Map).Returns(map);
            var sector = sectorMock.Object;

            sectorManagerMock.SetupGet(x => x.CurrentSector).Returns(sector);

            _sectorManager = sectorManager;
        }
Exemplo n.º 23
0
        private static IActor CreateHumanActor(HumanPlayer humanPlayer,
                                               IPerson humanPerson,
                                               ISectorManager sectorManager,
                                               IPlayerEventLogService playerEventLogService)
        {
            var playerActorStartNode = sectorManager.CurrentSector.Map.Regions
                                       .SingleOrDefault(x => x.IsStart)
                                       .Nodes
                                       .First();

            humanPlayer.MainPerson = humanPerson;

            var actor = new Actor(humanPerson, humanPlayer, playerActorStartNode);

            playerEventLogService.Actor = actor;

            sectorManager.CurrentSector.ActorManager.Add(actor);

            return(actor);
        }
Exemplo n.º 24
0
 public LootDetectedTrigger(IPropContainerManager propContainerManager, ISectorManager sectorManager)
 {
     _propContainerManager = propContainerManager;
     _map = sectorManager.CurrentSector.Map;
 }
 protected SpecialActorCommandBase(IGameLoop gameloop,
                                   ISectorManager sectorManager,
                                   ISectorUiState playerState) : base(gameloop, sectorManager, playerState)
 {
 }
Exemplo n.º 26
0
        public LootDetectedTrigger(ISectorManager sectorManager)
        {
            _sectorManager = sectorManager ?? throw new System.ArgumentNullException(nameof(sectorManager));

            _map = sectorManager.CurrentSector.Map;
        }
 public SectorTransitionMoveCommand(
     ISectorManager sectorManager,
     ISectorUiState playerState) :
     base(sectorManager, playerState)
 {
 }
Exemplo n.º 28
0
 public ExploreLogicState(IDecisionSource decisionSource, ISectorManager sectorManager) : base(decisionSource, sectorManager)
 {
 }
 public IntruderDetectedTrigger(IActorManager actorManager, ISectorManager sectorManager)
 {
     _actorManager = actorManager;
     _map          = sectorManager.CurrentSector.Map;
 }
Exemplo n.º 30
0
 protected SpecialActorCommandBase(
     ISectorManager sectorManager,
     ISectorUiState playerState) : base(sectorManager, playerState)
 {
 }