Пример #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);
        }
Пример #2
0
        private void CreateObjects()
        {
            padManager.Create(gameConfig, players);
            borderManager.Create(screen, gameConfig, players);

            foreach (var pad in padManager)
            {
                borderCollisionManager.DetectAndVerify(borderManager, pad.Item3);
            }
        }