Exemple #1
0
 public NotifyPathAggregateWhenCellsAreOccupied(MapAggregate map, TowersAggregate tower, WallsAggregate wall,
                                                [NotNull] PathFinderAggregate pathFinder)
 {
     _pathFinder = pathFinder ?? throw new ArgumentNullException(nameof(pathFinder));
     map.Events.OfType <MapEvent, MapEvent.Initialized>().Subscribe(HandleMapInitialized);
     tower.Events.OfType <TowersEvent, TowersEvent.TowerRepaired>().Subscribe(HandleTowerRepaired);
     wall.Events.OfType <WallsEvent, WallsEvent.WallRepaired>().Subscribe(HandleWallRepaired);
 }
Exemple #2
0
    void Update()
    {
        //Handle clicks
        if (Input.GetMouseButtonDown(0))
        {
            Vector3 clickedPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            var     xCoordinate     = (int)Math.Round(clickedPosition.x);
            var     yCoordinate     = (int)Math.Round(clickedPosition.y);

            MapAggregate.ClickMapCell(xCoordinate, yCoordinate);
        }
    }
 public RepairTowersWhenMapCellClicked(MapAggregate map, TowersAggregate Towers)
 {
     map.Events
     .OfType <MapEvent, MapEvent.MapCellClicked>()
     .Subscribe(clicked => RepairTowers(clicked, Towers));
 }
Exemple #4
0
 public InitializeWallsWhenMapInitialized(MapAggregate map, WallsAggregate walls)
 {
     map.Events
     .OfType <MapEvent, MapEvent.Initialized>()
     .Subscribe(initialized => InitilizeWalls(initialized, walls));
 }
 public InitializeTowersWhenMapInitialized(MapAggregate map, TowersAggregate towers)
 {
     map.Events
     .OfType <MapEvent, MapEvent.Initialized>()
     .Subscribe(initialized => InitializeTowers(initialized, towers));
 }
Exemple #6
0
 private void CreateLevel()
 {
     MapAggregate.Initialize(BOARD_SIZE, BOARD_SIZE);
 }
 public RepairWallsWhenMapCellClicked(MapAggregate map, WallsAggregate walls)
 {
     map.Events
     .OfType <MapEvent, MapEvent.MapCellClicked>()
     .Subscribe(clicked => RepairWalls(clicked, walls));
 }