Пример #1
0
        public override void Initialize()
        {
            EventManager.Instance.RegisterListener <PlayerLostEvent>(this);

            _processManager = new ProcessManager();

            _mainCamera = new Camera(Constants.Global.WINDOW_WIDTH, Constants.Global.WINDOW_HEIGHT);
            _pongCamera = new PongCamera(Constants.Global.SCREEN_WIDTH, Constants.Global.SCREEN_HEIGHT);
            // The camera response to size changes
            EventManager.Instance.RegisterListener <ResizeEvent>(_mainCamera);

            _root = new Root(GameManager.GraphicsDevice.Viewport.Width,
                             GameManager.GraphicsDevice.Viewport.Height);
            _root.RegisterListeners();

            PresentationParameters pp = GameManager.GraphicsDevice.PresentationParameters;

            _pongRenderTarget = new RenderTarget2D(GameManager.GraphicsDevice,
                                                   Constants.Global.SCREEN_WIDTH,
                                                   Constants.Global.SCREEN_HEIGHT,
                                                   false,
                                                   SurfaceFormat.Color,
                                                   DepthFormat.None);

            VelocityParticleManager = new ParticleManager <VelocityParticleInfo>(1024 * 20, VelocityParticleInfo.UpdateParticle);

            _quadEffect = new BasicEffect(GameManager.GraphicsDevice);
            _quadEffect.AmbientLightColor = new Vector3(1, 1, 1);
            _quadEffect.World             = Matrix.Identity;
            _quadEffect.TextureEnabled    = true;
            _quad = new Quad(new Vector3(-Constants.Global.SCREEN_ASPECT_RATIO, 1, 0),
                             new Vector3(Constants.Global.SCREEN_ASPECT_RATIO, 1, 0),
                             new Vector3(-Constants.Global.SCREEN_ASPECT_RATIO, -1, 0),
                             new Vector3(Constants.Global.SCREEN_ASPECT_RATIO, -1, 0),
                             Vector3.Forward);

            PongPostProcessor = new PostProcessor(GameManager.GraphicsDevice,
                                                  Constants.Global.SCREEN_WIDTH,
                                                  Constants.Global.SCREEN_HEIGHT);

            InitSystems();

            _directors = new BaseDirector[] {
                new PongDirector(this),
                new AstheticsDirector(this),
                new FluctuationDirector(this)
            };
            for (int i = 0; i < _directors.Length; i++)
            {
                _directors[i].RegisterEvents();
            }
        }
Пример #2
0
 public CameraRollFluctuation(IPongDirectorOwner owner) : base(owner)
 {
     _camera = owner.PongCamera;
 }
Пример #3
0
 public CameraWobbleFluctuation(IPongDirectorOwner owner) : base(owner)
 {
     _camera = _owner.PongCamera;
 }