Exemplo n.º 1
0
        public IEntityLogic CreateEntity(SimultaneousSim sim, object info)
        {
            var entity = new PlayerEntity(this);

            if (sim == _observerSim)
            {
                _observerPlayer = entity;
            }
            else if (sim == _controllerSim)
            {
                //entity.LogState = true;
                _controllerPlayer = entity;
            }
            return(entity);
        }
Exemplo n.º 2
0
        public LocalEntity(Guid id, IEntityLogic logic, SimultaneousSim sim, EntityRole role, float updatePeriod = 100f)
        {
            Id     = id;
            _logic = logic;
            _sim   = sim;
            Role   = role;

            _recordedFrameSnapshots = new List <FrameSnapshot>();
            _recordedFrameCommands  = new List <FrameCommands>();
            _recievedEnvelopes      = new List <RecievedCmdEnvelope>();

            _clientEntities = new List <IEntity>();

            UpdatePeriod = updatePeriod;

            NetworkEntityAdded(this);
        }
Exemplo n.º 3
0
        public Game()
            : base("YOUR_ORGANIZATION", "PROJECT_NAME")
        {
            _frameWatch = Stopwatch.StartNew();

            _authorityNet = new LiteNetLibNetwork(CreateSerializer());
            _authoritySim = new SimultaneousSim(this, _authorityNet);
            _authoritySim.ListenToPort(5555);
            _authoritySim.ClientSimConnected += _authoritySim_ClientSimConnected;

            _controllerNet = new LiteNetLibNetwork(CreateSerializer());
            _controllerSim = new SimultaneousSim(this, _controllerNet);
            _controllerSim.ConnectToHost("localhost", 5555);

            _observerNet = new LiteNetLibNetwork(CreateSerializer());
            _observerSim = new SimultaneousSim(this, _observerNet);
            _observerSim.ConnectToHost("localhost", 5555);
        }