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(); }
private void AddAlienToGameField() { double x = RandomProvider.NextDouble() * m_world.Size.Width; double y = RandomProvider.NextDouble() * m_world.Size.Height; Plane alien = XWingPlane.BasicConfiguration(new Vector(x, y)); base.AddAlienPlaneToField(alien, new AlienPlaneController(m_world, alien)); }
public override void Update(TimeSpan elapsed) { if (!m_added) { double x = RandomProvider.NextDouble() * m_world.Size.Width; double y = RandomProvider.NextDouble() * m_world.Size.Height; Plane alien = XWingPlane.BasicConfiguration(new Vector(x, y)); base.AddAlienPlaneToField(alien, new AlienPlaneController(m_world, alien)); m_added = true; } }
public XWingPlaneXna(PlanesGame game, XWingPlane xWingPlane, CoordinatesTransformer coordinatesTransformer) : base(game, xWingPlane, coordinatesTransformer) { }