示例#1
0
        public SinglePlayerSubScene(int backBufferWidth, int backBufferHeight)
            : base(backBufferWidth, backBufferHeight)
        {
            _motionController    = new MotionController();
            _animationController = new AnimationController();
            _timerController     = new TimerController();

            _pauseController = new PauseController();
            _pauseController.AddPausableObject(_timerController);
            _pauseController.AddPausableObject(_animationController);

            _cameraController          = new Bopscotch.Gameplay.Controllers.PlayerTrackingCameraController();
            _cameraController.Viewport = new Rectangle(0, 0, backBufferWidth, backBufferHeight);
            _cameraController.ScrollBoundaryViewportFractions = new Vector2(Definitions.Horizontal_Scroll_Boundary_Fraction, Definitions.Vertical_Scroll_Boundary_Fraction);

            Renderer.ClipOffCameraRendering(_cameraController, Camera_Clipping_Margin);

            _playerCollisionController = new OneToManyCollisionController();

            _opaqueParticleEffectManager   = new OpaqueLayerParticleEffectManager(_cameraController);
            _additiveParticleEffectManager = new AdditiveLayerParticleEffectManager(_cameraController);

            _levelFactory = new Bopscotch.Gameplay.LevelFactory(RegisterGameObject, _timerController.RegisterUpdateCallback);
            _levelFactory.BackgroundDimensions = new Point(backBufferWidth, backBufferHeight);

            _smashBlockItemFactory = new Effects.SmashBlockItems.SmashBlockItemFactory(RegisterGameObject, _timerController.RegisterUpdateCallback);

            _speedometer = new Bopscotch.Gameplay.Objects.Display.Speedometer();
            _speedometer.CenterPosition       = new Vector2(backBufferWidth, 0.0f);
            _playerEventPopup                 = new PlayerEventPopup();
            _playerEventPopup.DisplayPosition = new Vector2(backBufferWidth / 2.0f, backBufferHeight / 4.0f);

            _active = false;
        }
        public GameplaySceneBase(string sceneID)
            : base(sceneID)
        {
            _inputProcessor = Input.TouchControls.CreateController();

            _motionController    = new MotionController();
            _animationController = new AnimationController();
            _timerController     = new TimerController();

            _pauseController = new PauseController();
            _pauseController.AddPausableObject(_timerController);
            _pauseController.AddPausableObject(_animationController);

            _cameraController          = new Bopscotch.Gameplay.Controllers.PlayerTrackingCameraController();
            _cameraController.Viewport = new Rectangle(0, 0, Definitions.Back_Buffer_Width, Definitions.Back_Buffer_Height);
            _cameraController.ScrollBoundaryViewportFractions = new Vector2(Definitions.Horizontal_Scroll_Boundary_Fraction, Definitions.Vertical_Scroll_Boundary_Fraction);

            Renderer.ClipOffCameraRendering(_cameraController, Camera_Clipping_Margin);

            _playerCollisionController = new OneToManyCollisionController();

            _opaqueParticleEffectManager   = new OpaqueLayerParticleEffectManager(_cameraController);
            _additiveParticleEffectManager = new AdditiveLayerParticleEffectManager(_cameraController);

            _levelFactory = new Bopscotch.Gameplay.LevelFactory(RegisterGameObject, _timerController.RegisterUpdateCallback);

            _smashBlockItemFactory = new Effects.SmashBlockItems.SmashBlockItemFactory(RegisterGameObject, _timerController.RegisterUpdateCallback);

            _speedometer      = new Bopscotch.Gameplay.Objects.Display.Speedometer();
            _playerEventPopup = new Bopscotch.Gameplay.Objects.Display.PlayerEventPopup();

            _objectWithGlowEffect = new List <ICanHaveGlowEffect>();
        }
示例#3
0
        protected override void RegisterGameObject(IGameObject toRegister)
        {
            if (toRegister is IMobile)
            {
                _motionController.AddMobileObject((IMobile)toRegister);
            }
            if (toRegister is IAnimated)
            {
                _animationController.AddAnimatedObject((IAnimated)toRegister);
            }
            if (toRegister is ICameraLinked)
            {
                _cameraController.AddCameraLinkedObject((ICameraLinked)toRegister);
            }
            if (toRegister is ICollidable)
            {
                _playerCollisionController.AddCollidableObject((ICollidable)toRegister);
            }
            if (toRegister is IPausable)
            {
                _pauseController.AddPausableObject((IPausable)toRegister);
            }

            base.RegisterGameObject(toRegister);
        }
        protected override void RegisterGameObject(IGameObject toRegister)
        {
            if (toRegister is IMobile)
            {
                _motionController.AddMobileObject((IMobile)toRegister);
            }
            if (toRegister is IAnimated)
            {
                _animationController.AddAnimatedObject((IAnimated)toRegister);
            }
            if (toRegister is ICameraLinked)
            {
                _cameraController.AddCameraLinkedObject((ICameraLinked)toRegister);
            }
            if (toRegister is ICollidable)
            {
                _playerCollisionController.AddCollidableObject((ICollidable)toRegister);
            }
            if (toRegister is IPausable)
            {
                _pauseController.AddPausableObject((IPausable)toRegister);
            }

            if (toRegister is SmashBlock)
            {
                ((SmashBlock)toRegister).SmashCallback = HandleSmashBlockSmash;
            }
            if (toRegister is ICanHaveGlowEffect)
            {
                _objectWithGlowEffect.Add((ICanHaveGlowEffect)toRegister);
            }

            base.RegisterGameObject(toRegister);
        }