Ejemplo n.º 1
0
 public ApplyDamageController(
     IUnitSettings unitSettings,
     IOccupatedPossitionsMap occupatedPossitionsMap)
 {
     _occupatedPossitionsMap = occupatedPossitionsMap;
     _unitSettings           = unitSettings;
 }
Ejemplo n.º 2
0
 public MoveStepByStepController(
     IUnitGameObjectController unitGameObjectController,
     IOccupatedPossitionsMap occupatedPossitionsMap)
 {
     _unitGameObjectController = unitGameObjectController;
     _occupatedPossitionsMap = occupatedPossitionsMap;
 }
Ejemplo n.º 3
0
 public WaitObstacleController(IOccupatedPossitionsMap occupatedPossitionsMap,
                               IBaseActionController baseActionController)
 {
     _occupatedPossitionsMap = occupatedPossitionsMap;
     _baseActionController   = baseActionController;
     _subscribedUnits        = new List <IOneUnitController>();
 }
Ejemplo n.º 4
0
        public UnitsController(
            EnemyController.Factory enemyFactory,
            IOccupatedPossitionsMap occupatedPossitionsMap,
            IGrid grid,
            IPlayerController player)
        {
            _occupatedPossitionsMap = occupatedPossitionsMap;
            _enemyFactory           = enemyFactory;
            _grid = grid;

            _player = player;

            var ch = new ChaosBattlefield(enemyFactory, _occupatedPossitionsMap);

            ch.Activate();

/*
 *           var enemy1 = _enemyFactory.Invoke();
 *           enemy1.SetOnPosition(new IntVector2(0,5));
 *
 *           var enemy2 = _enemyFactory.Invoke();
 *           enemy2.SetOnPosition(new IntVector2(1,6));
 *
 *           var enemy3 = _enemyFactory.Invoke();
 *           enemy3.SetOnPosition(new IntVector2(1,5));
 *
 *           var enemy4 = _enemyFactory.Invoke();
 *           enemy4.SetOnPosition(new IntVector2(4,4));
 *
 *           var enemy5 = _enemyFactory.Invoke();
 *           enemy5.SetOnPosition(new IntVector2(5,5));
 *
 *           var enemy6 = _enemyFactory.Invoke();
 *           enemy6.SetOnPosition(new IntVector2(5,6));
 *
 *           var enemy7 = _enemyFactory.Invoke();
 *           enemy7.SetOnPosition(new IntVector2(5,7));
 *
 *           var enemy8 = _enemyFactory.Invoke();
 *           enemy8.SetOnPosition(new IntVector2(5,8));
 *
 *           var enemy9 = _enemyFactory.Invoke();
 *           enemy9.SetOnPosition(new IntVector2(5,9));
 *
 *           enemy1.Attack(_player);
 *           enemy2.Attack(_player);
 *           enemy3.Attack(_player);
 *           enemy4.Attack(_player);
 *           enemy5.Attack(_player);
 *           enemy6.Attack(_player);
 *           enemy7.Attack(_player);
 *           enemy8.Attack(_player);
 *           enemy9.Attack(_player);
 *          /*
 *          for (int i = 0; i < 8; i++)
 *          {
 *              GenerateEnemy();
 *          }*/
        }
Ejemplo n.º 5
0
 private void InitializeMap(List <OneUnitControllerMock> list)
 {
     _occupatedPossitionsMap = new OccupatedPossitionsMap();
     foreach (var unitControllerMock in list)
     {
         _occupatedPossitionsMap.AddUnit(unitControllerMock);
     }
 }
Ejemplo n.º 6
0
 public HostileController(
     IBaseActionController baseActionController,
     TargetOvertaker targetOvertaker,
     IOccupatedPossitionsMap occupatedPossitionsMap)
 {
     _baseActionController   = baseActionController;
     _occupatedPossitionsMap = occupatedPossitionsMap;
     _targetOvertaker        = targetOvertaker;
 }
Ejemplo n.º 7
0
 public NoWayPlacidController(
     IOccupatedPossitionsMap occupatedPossitionsMap,
     IMovingRandomizer movingRandomizer,
     IUnitInfoInternal unitInfo,
     IBaseActionController baseActionController
     )
 {
     _occupatedPossitionsMap = occupatedPossitionsMap;
     _movingRandomizer       = movingRandomizer;
     _baseActionController   = baseActionController;
     _unitInfo = unitInfo;
 }
Ejemplo n.º 8
0
 public FreePointToGoResolver(
     IAdjacentPointsResolver adjacentPointsResolver,
     IPathFinderController pathFinderController,
     IBaseActionController baseActionController,
     IOccupatedPossitionsMap occupatedPossitionsMap,
     IFreePossitionsMap freePossitionsMap)
 {
     _freePossitionsMap      = freePossitionsMap;
     _adjacentPointsResolver = adjacentPointsResolver;
     _pathFinder             = pathFinderController;
     _occupatedPossitionsMap = occupatedPossitionsMap;
     _baseActionController   = baseActionController;
 }
Ejemplo n.º 9
0
        public MoveConsideringOccupatedController(
            IOccupatedPossitionsMap occupatedPossitionsMap,
            IUnitGameObjectController unitGameObjectController,
            IPathGeneratorController pathGeneratorController,
            IMoveStepByStepController moveStepByStepController
            )
        {
            _occupatedPossitionsMap   = occupatedPossitionsMap;
            _moveStepByStepController = moveStepByStepController;
            _unitGameObjectController = unitGameObjectController;
            _pathGeneratorController  = pathGeneratorController;

            SubscribeOnEvent();
        }
Ejemplo n.º 10
0
        public ChaosBattlefield(
            EnemyController.Factory enemyFactory,
            IOccupatedPossitionsMap occupatedPossitionsMap)
        {
            _enemyFactory           = enemyFactory;
            _occupatedPossitionsMap = occupatedPossitionsMap;
            _unitsCountNotifier     = new UnitsCountNotifier();
            _unitNameResolver       = new UnitNameResolver();
            _unitsCountNotifier.UnitsCountDecreased += OnUnitsCountDecreased;

            TOP_LEFT     = new IntVector2(0, 10);
            BOTTOM_RIGHT = new IntVector2(10, 0);

            _random = new Random();
        }
Ejemplo n.º 11
0
        public ChaosUnitController(EnemyController unit,
                                   UnitsCountNotifier unitsCountNotifier,
                                   IOccupatedPossitionsMap occupatedPossitionsMap,
                                   UnitNameResolver unitNameResolver,
                                   ChaosBattlefield.SquareArea area)
        {
            _unit = unit;
            _occupatedPossitionsMap = occupatedPossitionsMap;
            _unitsCountNotifier     = unitsCountNotifier;
            _unitNameResolver       = unitNameResolver;
            _unitName = _unitNameResolver.ResolveNextName();
            _area     = area;

            Initialize();
        }
Ejemplo n.º 12
0
        public EnemyController(
            IPeacefulBehaviour peacefulBehaviour,
            IAgressiveBehaviour agressiveBehaviour,
            IOccupatedPossitionsMap occupatedPossitionsMap,
            IStateControllerExternal stateController,
            ILifeController lifeController,
            IUnitEvents unitEvents,
            IUnitInfoExternal unitInfoExternal
            ) : base(occupatedPossitionsMap, unitEvents, stateController, lifeController, unitInfoExternal)
        {
            _peacefulBehaviour      = peacefulBehaviour;
            _agressiveBehaviour     = agressiveBehaviour;
            _occupatedPossitionsMap = occupatedPossitionsMap;

            Initialize();
        }
Ejemplo n.º 13
0
        public PlayerController(
            IGameEvents gameEvents,
            IEventDispatcher eventDispatcher,
            IUnitSettings unitSettings,
            IOccupatedPossitionsMap occupatedPossitionsMap,
            IStateControllerExternal stateController,
            ILifeController lifeController,
            IUnitEvents unitEvents,
            IUnitInfoExternal unitInfo
            ) : base(occupatedPossitionsMap, unitEvents, stateController, lifeController, unitInfo)
        {
            _gameEvents      = gameEvents;
            _eventDispatcher = eventDispatcher;
            _unitSettings    = unitSettings;

            Initialize();
        }
Ejemplo n.º 14
0
        public OneUnitController(
            IOccupatedPossitionsMap occupatedPossitionsMap,
            IUnitEvents unitEvents,
            IStateControllerExternal stateController,
            ILifeController lifeController,
            IUnitInfoExternal unitInfoExternal)
        {
            _occupatedPossitionsMap = occupatedPossitionsMap;
            _unitEvents             = unitEvents;
            _unitInfoExternal       = unitInfoExternal;
            _stateController        = stateController;
            _lifeController         = lifeController;

            _occupatedPossitionsMap.AddUnit(this);
            _unitEvents.HealthEnded     += HealthEndedHandler;
            _unitEvents.DieComplete     += DieCompleteHandler;
            _lifeController.HealthEnded += HealthEndedHandler;
        }
Ejemplo n.º 15
0
        public static List <IOneUnitController> GetUnitsInRegion(this IOccupatedPossitionsMap possitionsMap,
                                                                 IntVector2 point1, IntVector2 point2)
        {
            var units       = new List <IOneUnitController>();
            var loopParamsI = new LoopPaprams(point1.x, point2.x);

            for (int i = loopParamsI.StartValue; loopParamsI.Condition(i); i = loopParamsI.Operation(i))
            {
                var loopParamsJ = new LoopPaprams(point1.y, point2.y);
                for (int j = loopParamsJ.StartValue; loopParamsJ.Condition(j); j = loopParamsJ.Operation(j))
                {
                    if (!possitionsMap.IsVacantPosition(new IntVector2(i, j)))
                    {
                        units.Add(possitionsMap.GetUnitOnPosition(new IntVector2(i, j)));
                    }
                }
            }

            return(units);
        }
Ejemplo n.º 16
0
        public static List <IntVector2> GetFreePositionsInRegion(this IOccupatedPossitionsMap possitionsMap,
                                                                 IntVector2 point1, IntVector2 point2)
        {
            var positions    = new List <IntVector2>();
            var tempPosition = IntVector2Constant.UNASSIGNET;

            var loopParamsI = new LoopPaprams(point1.x, point2.x);

            for (int i = loopParamsI.StartValue; loopParamsI.Condition(i); i = loopParamsI.Operation(i))
            {
                var loopParamsJ = new LoopPaprams(point1.y, point2.y);
                for (int j = loopParamsJ.StartValue; loopParamsJ.Condition(j); j = loopParamsJ.Operation(j))
                {
                    tempPosition = new IntVector2(i, j);
                    if (possitionsMap.IsVacantPosition(tempPosition))
                    {
                        positions.Add(tempPosition);
                    }
                }
            }

            return(positions);
        }
Ejemplo n.º 17
0
 public OccupatedMapExtensionsTests()
 {
     _occupatedPossitionsMap = new OccupatedPossitionsMap();
 }
Ejemplo n.º 18
0
 public FreePositionsMap(IGrid grid, IOccupatedPossitionsMap occupatedPossitionsMap)
 {
     _grid = grid;
     _occupatedPossitionsMap = occupatedPossitionsMap;
 }
Ejemplo n.º 19
0
 public MoveStepByStepTests()
 {
     _occupatedPossitionsMap   = Mock.Create <IOccupatedPossitionsMap>();
     _stateController          = Mock.Create <IStateControllerExternal>();
     _unitGameObjectController = new UnitGameObjectControllerMock();
 }