Exemplo n.º 1
0
        public Game()
        {
            screen = new Screen
            {
                Width  = ScreenWidth,
                Height = ScreenHeight
            };

            levelManager           = new LevelManager();
            collisionManager       = new CollisionManager();
            screenCollisionManager = new ScreenCollisionManager(screen);
            randomGenerator        = new RandomGenerator();
            tailManager            = new TailManager();
            ballManager            = new BallManager();
            borderManager          = new BorderManager();
            padManager             = new PadManager(screen);

            ballStateMachine = new BallStateMachine(this, screenCollisionManager, collisionManager, padManager, borderManager, levelManager);

            padManager.Add(Edge.Top);
            padManager.Add(Edge.Bottom);

            borderManager.Create(screen);

            foreach (var pad in padManager)
            {
                VerifyBorderCollision(pad);
            }

            IBall ball = new Ball(randomGenerator);

            ball.SetSize(15, 15);
            ballManager.Add(ball);
        }
Exemplo n.º 2
0
 public GamePlayfieldView(
     IRenderProxy render,
     ICollection <IBrick> bricks,
     IBorderManager borderManager
     )
 {
     this.render        = render;
     this.bricks        = bricks;
     this.borderManager = borderManager;
 }
Exemplo n.º 3
0
        public BallInGameState(Game game, IScreenCollisionManager screenCollisionManager, ICollisionManager collisionManager, IPadManager padManager, IBorderManager borderManager, ILevelManager levelManager)
        {
            this.game = game;
            this.screenCollisionManager = screenCollisionManager;
            this.collisionManager       = collisionManager;
            this.padManager             = padManager;
            this.borderManager          = borderManager;
            this.levelManager           = levelManager;

            collisionManagerForMoveReversion = new CollisionManager();
        }
Exemplo n.º 4
0
        public BallStateMachine(Game game,
                                IScreenCollisionManager screenCollisionManager,
                                ICollisionManager collisionManager,
                                IPadManager padManager,
                                IBorderManager borderManager,
                                ILevelManager levelManager)
        {
            ballInGameState = new BallInGameState(game, screenCollisionManager, collisionManager, padManager, borderManager, levelManager);
            ballInMenuState = new BallInMenuState(game, padManager);

            currentState = ballInMenuState;
        }
Exemplo n.º 5
0
 public PadCollisionCommand(
     IPadManager padManager,
     IBorderManager borderManager,
     IScreenCollisionManager screenCollisionManager,
     ICollisionManager collisionManager,
     BallCollisionState collisionState)
 {
     this.padManager             = padManager;
     this.collisionManager       = collisionManager;
     this.screenCollisionManager = screenCollisionManager;
     this.borderManager          = borderManager;
     this.collisionState         = collisionState;
 }
Exemplo n.º 6
0
        public GameEngine(int number)
        {
            GameConfig.Mouses = number;

            screen = new Screen
            {
                Width  = ScreenWidth,
                Height = ScreenHeight
            };

            ManagerScope = managerScopeFactory.Create(screen);

            levelManager           = ManagerScope.Resolve <ILevelManager>();
            ballManager            = ManagerScope.Resolve <IBallManager>();
            padManager             = ManagerScope.Resolve <IPadManager>();
            tailManager            = ManagerScope.Resolve <ITailManager>();
            borderManager          = ManagerScope.Resolve <IBorderManager>();
            collisionManager       = ManagerScope.Resolve <ICollisionManager>();
            screenCollisionManager = ManagerScope.Resolve <IScreenCollisionManager>();
            borderCollisionManager = ManagerScope.Resolve <IBorderCollisionManager>();

            FireBallCounter = new FireBallCounter(tailManager);

            ballStateMachine = new BallStateMachine(
                ManagerScope,
                Bricks,
                HitBrick,
                LostBall);

            ballBuilder = new BallBuilder(
                ballManager,
                tailManager,
                padManager,
                FastBallCounter.TimerHandler);

            ballExtraFeatureBuilder = new BallExtraFeatureBuilder(
                ballManager,
                tailManager,
                ballBuilder,
                FireBallCounter);

            levelBuilder = new LevelBuilder(
                screen,
                levelManager,
                padManager,
                borderManager,
                borderCollisionManager,
                ballBuilder,
                GameConfig,
                Bricks);
        }
        public StylesheetManager(IFontManager fontManager, IBorderManager borderManager, IFillManager fillManager, INumberingFormatManager numberingFormatManager, ICellFormatManager cellFormatManager)
        {
            FontManager            = fontManager as FontManager;
            BorderManager          = borderManager as BorderManager;
            FillManager            = fillManager as FillManager;
            NumberingFormatManager = numberingFormatManager as NumberingFormatManager;
            CellFormatManager      = cellFormatManager as CellFormatManager;

            ActualStyleSheet = new Stylesheet {
                Fonts            = FontManager.ActualFonts,
                Borders          = BorderManager.ActualBorders,
                Fills            = FillManager.ActualFills,
                NumberingFormats = NumberingFormatManager.ActualNumberingFormats,
                CellFormats      = CellFormatManager.ActualCellFormats
            };
        }
Exemplo n.º 8
0
 public LevelBuilder(
     IScreen screen,
     ILevelManager levelManager,
     IPadManager padManager,
     IBorderManager borderManager,
     IBorderCollisionManager borderCollisionManager,
     BallBuilder ballBuilder,
     IGameConfig gameConfig,
     ICollection <IBrick> bricks)
 {
     this.screen                 = screen;
     this.levelManager           = levelManager;
     this.padManager             = padManager;
     this.borderManager          = borderManager;
     this.borderCollisionManager = borderCollisionManager;
     this.ballBuilder            = ballBuilder;
     this.gameConfig             = gameConfig;
     this.bricks                 = bricks;
 }