Пример #1
0
        public void Initialize()
        {
            // getting game world from server
            JoinResult initInfo = m_client.Join();

            m_ownGuid   = initInfo.PlayerGuid; // assigned by server unique own identifier to identify player
            m_gameWorld = new ClientGameWorld(initInfo.LogicalSize);

            foreach (var staticObject in initInfo.StaticObjects)
            {
                m_gameWorld.AddStaticObject(staticObject);
            }

            m_gameWorldXna = new GameWorldXna(m_game, m_gameWorld, new Rectangle(0, 0, m_game.Graphics.PreferredBackBufferWidth, m_game.Graphics.PreferredBackBufferHeight));
            m_gameWorldXna.Initialize();

            m_infoPanel = new InfoPanel(m_game, m_gameWorldXna);

            #region Create plane, controller and set camera
            m_ownPlane            = XWingPlane.BasicConfiguration(new Vector(m_gameWorld.Size.Width / 2.0, m_gameWorld.Size.Height / 2.0));
            m_ownPlane.PlayerGuid = m_ownGuid;

            m_gameWorld.AddPlaneController(new LocalPlaneController(m_ownPlane));

            m_gameWorldXna.CenterOfViewGameObject = m_ownPlane;
            m_gameWorldXna.ForceSetCameraOnCenterOfView();
            #endregion

            m_synchronizer = new ObjectsSynchronizer(m_client, m_gameWorld, m_ownGuid, m_ownPlane);

            m_gameWorld.AddGameObject(m_ownPlane); // Add after subscribing of GameWorld events

            m_infoPanel.PlaneInfoPanel.Plane = m_ownPlane;
            m_infoPanel.Initialize();
        }
Пример #2
0
 protected DrawablePlane(PlanesGame game, Plane plane, CoordinatesTransformer coordinatesTransformer)
     : base(game, plane, coordinatesTransformer)
 {
 }
Пример #3
0
 public LocalPlaneController(Plane plane)
     : base(plane)
 {
 }