コード例 #1
0
        public void Awake()
        {
            var tileStyleRepository = new TileStyleRepository();
            var tileStyle           = tileStyleRepository.ObtainDefault();
            var tileFactory         = new TileFactory();
            var boardFactory        = new BoardFactory(tileFactory);

            var boardSettingsRepository = new BoardSettingsRepository();
            var boardSettings           = boardSettingsRepository.ObtainDefault();
            var board = boardFactory.Create(boardSettings, tileStyle);

            var boardMouseEventsNotifier = new MouseEventsNotifier(board);

            boardMouseEventsNotifier.Enable();

            var ballSelectionEventsNotifier = new BallSelectionEventsNotifier(boardMouseEventsNotifier);

            ballSelectionEventsNotifier.Enable();

            var pathfinder = new Pathfinder();
            var ballMoveControllerFactory = new BallMoveControllerFactory(pathfinder);
            var ballMoveController        = ballMoveControllerFactory.Create(ballSelectionEventsNotifier);

            ballMoveController.Enable();

            var ballBounceManager    = new BallBounceManager(board);
            var ballBounceController = new BallBounceController(ballSelectionEventsNotifier, ballBounceManager);

            ballBounceController.Enable();

            var ballMaterialSettingsRepository        = new BallMaterialSettingsRepository();
            var ballStyleRepository                   = new BallStyleRepositoryFactory(ballMaterialSettingsRepository).Create();
            var ballLifetimeManagerSettingsRepository = new BallLifetimeManagerSettingsRepository();
            var ballLifetimeManagerSettings           = ballLifetimeManagerSettingsRepository.ObtainDefault();
            var ballFactory             = new BallFactory();
            var random                  = new System.Random();
            var ballSpawnManagerFactory = new BallSpawnManagerFactory(
                ballLifetimeManagerSettings,
                ballStyleRepository,
                ballFactory,
                random
                );
            var ballColorPool = new BallColorPoolRepository().ObtainDefault();

            ballSpawnManager = ballSpawnManagerFactory.Create(board, ballColorPool);
            var ballPopManager         = new BallPopManager(board);
            var ballLifespanController = new BallLifespanController(ballSpawnManager, ballPopManager);

            ballLifespanController.Enable();

            var tileColorStyle = new TileColorStyle(
                TileColorStyleHelper.CreateVariantColorGroup(
                    tileStyle.ColorStyle.ForegroundColorGroup.IdleColor
                    ),
                tileStyle.ColorStyle.BorderColorGroup
                );
            var boardHighlightController = new BoardHighlightController(boardMouseEventsNotifier, tileColorStyle);

            boardHighlightController.Enable();
        }
コード例 #2
0
 public void Enable()
 {
     ballSelectionEventsNotifier.Enable();
     ballSelectionEventsNotifier.OnBallSelected   += OnBallSelected;
     ballSelectionEventsNotifier.OnBallDeselected += OnBallDeselected;
 }