Ejemplo n.º 1
0
 public CollisionManager(Game game, UserManager userManager, ProjectileManager projectileManager, WeaponsManager weaponsManager)
     : base(game)
 {
     _userManager = userManager;
     _projectileManager = projectileManager;
     _weaponsManager = weaponsManager;
 }
Ejemplo n.º 2
0
 public InputManager(Game game, UserManager userManager, ProjectileManager projectileManager)
     : base(game)
 {
     _game = game;
     _userManager = userManager;
     _projectileManager = projectileManager;
     _actionList = new List<Action>();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Allows the app to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            IsMouseVisible = true; // easier for debugging not to "lose" mouse
            SetWindowOnSurface();
            InitializeSurfaceInput();

            // Set the application's orientation based on the orientation at launch
            _currentOrientation = ApplicationServices.InitialOrientation;

            // Subscribe to surface window availability events
            ApplicationServices.WindowInteractive += OnWindowInteractive;
            ApplicationServices.WindowNoninteractive += OnWindowNoninteractive;
            ApplicationServices.WindowUnavailable += OnWindowUnavailable;

            // Setup the UI to transform if the UI is rotated.
            // Create a rotation matrix to orient the screen so it is viewed correctly
            // when the user orientation is 180 degress different.
            Matrix inverted = Matrix.CreateRotationZ(MathHelper.ToRadians(180)) *
                       Matrix.CreateTranslation(_graphics.GraphicsDevice.Viewport.Width,
                                                 _graphics.GraphicsDevice.Viewport.Height,
                                                 0);

            if (_currentOrientation == UserOrientation.Top)
            {
                _screenTransform = inverted;
            }

            //Setup User and Projectile Managers
            _userManager = new UserManager(this);
            _projectileManager = new ProjectileManager(this);
            _inputManager = new InputManager(this, _userManager, _projectileManager);
            _weaponsManager = new WeaponsManager(this);
            _collisionManager = new CollisionManager(this, _userManager, _projectileManager, _weaponsManager);
            Components.Add(_userManager);
            Components.Add(_projectileManager);
            Components.Add(_inputManager);
            Components.Add(_weaponsManager);
            Components.Add(_collisionManager);

            PubNubObservable.Publish(Constants.SURFACE_CHANNEL, new { start = true });

            base.Initialize();
        }