Ejemplo n.º 1
0
        public void Start(RemoteConnectionToken server, bool render = true)
        {
            DoRender = render;
            _node    = new NetworkNode();
            _node.Start(false);
            _connected = _node.Connect(server);
            if (render)
            {
                _win = new RenderWindow(new VideoMode(1024, 720), "SimpleGame");
                _win.SetVerticalSyncEnabled(true);
                _win.Closed += RenderWindow_Closed;
            }
            EnvironmentAPI.Input = new SFMLInput()
            {
                _win = _win
            };
            EnvironmentAPI.Draw = new SFMLDrawApi()
            {
                _win = _win
            };
            EnvironmentAPI.Time = new SFMLTime();
            EnvironmentAPI.Win  = new SFMLWindowApi()
            {
                _win = _win
            };
            _charView        = new View();
            _physicsWorld    = new VoltWorld();
            _node.CustomData = _physicsWorld;
            var map = DefsHolder.Instance.LoadDef <MapDef>("/TestMapDef");

            _debugCreator = new LocationCreator(map.Locations[0].CreatorDef, 0);
            _debugCreator.Setup(map.Locations[0].RootSite, map.Locations[0].Pos, map.Locations[0].Rot);
            while (_debugCreator.Tick())
            {
                ;
            }
        }
Ejemplo n.º 2
0
        public bool Start(int port = 9051)
        {
            _node = new NetworkNode();
            var started = _node.Start(port, 128, true);

            if (!started)
            {
                return(false);
            }
            _sessionId = _node.Create <SessionEntity>();
            _node.Create <VisibilityEntity>();
            _node.NewConnectionEstablished += NewConnection;
            _physicsWorld    = new VoltWorld();
            _node.CustomData = _physicsWorld;
            var map = DefsHolder.Instance.LoadDef <MapDef>("/TestMapDef");

            _debugCreator = new LocationCreator(map.Locations[0].CreatorDef, 0);
            _debugCreator.Setup(map.Locations[0].RootSite, map.Locations[0].Pos, map.Locations[0].Rot);
            while (_debugCreator.Tick())
            {
                ;
            }
            return(true);
        }