Ejemplo n.º 1
0
        public void Initialize()
        {
            _networkAgent = new NetworkAgent(AgentRole.Server, "Umbra");
            _networkAgent.OnPlayerConnect += OnPlayerConnect;
            _networkAgent.OnPlayerDisconnect += OnPlayerDisconnect;

            EntitySystem.BlackBoard.SetEntry("NetworkAgent", _networkAgent);

            _entityWorld = new EntityWorld();
            _entityWorld.InitializeAll(new[] { GetType().Assembly });

            CrawEntityManager.Instance.Initialize(_entityWorld, new ServerEntityFactory(_entityWorld));
        }
Ejemplo n.º 2
0
        protected override void Initialize()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _netAgent = new NetworkAgent(AgentRole.Client, "Umbra");

            EntitySystem.BlackBoard.SetEntry("Game", this);
            EntitySystem.BlackBoard.SetEntry("ContentManager", Content);
            EntitySystem.BlackBoard.SetEntry("SpriteBatch", spriteBatch);
            EntitySystem.BlackBoard.SetEntry("GraphicsDevice", GraphicsDevice);
            EntitySystem.BlackBoard.SetEntry("ContentManager", Content);
            EntitySystem.BlackBoard.SetEntry("NetworkAgent", _netAgent);

            _entityWorld = new EntityWorld();

            // create camera
            Vector3 camPosition = new Vector3(0, 10, 5);
            Matrix camRotation = Matrix.CreateFromAxisAngle(new Vector3(1, 0, 0), MathHelper.ToRadians(-65.0f));
            float aspectRatio = (float)GraphicsDevice.Viewport.Width / GraphicsDevice.Viewport.Height;

            CameraComponent cameraComponent = new CameraComponent(camPosition, camRotation, aspectRatio);

            Entity cameraEntity = _entityWorld.CreateEntity();
            cameraEntity.AddComponent(cameraComponent);

            EntitySystem.BlackBoard.SetEntry("Camera", cameraComponent);

            //// TEMP ////
            Map map = new Map(100, 100);
            Entity mapEntity = _entityWorld.CreateEntity();
            mapEntity.AddComponent(new TileMapComponent(map));

            EntitySystem.BlackBoard.SetEntry("Map", map);
            //// TEMP ////

            _entityWorld.InitializeAll(new[] { GetType().Assembly });

            CrawEntityManager.Instance.Initialize(_entityWorld, new ClientEntityFactory(_entityWorld));

            _netAgent.Connect("127.0.0.1");

            base.Initialize();
        }
Ejemplo n.º 3
0
 public override void LoadContent()
 {
     _networkAgent = BlackBoard.GetEntry<NetworkAgent>("NetworkAgent");
 }
Ejemplo n.º 4
0
 public override void LoadContent()
 {
     _netAgent = BlackBoard.GetEntry<NetworkAgent>("NetworkAgent");
     _camera = BlackBoard.GetEntry<CameraComponent>("Camera");
 }