Exemple #1
0
    public CreateMoverSystem(Contexts contexts, Services services) : base(contexts.input)
    {
        _gameContext  = contexts.game;
        _inputContext = contexts.input;
//        ContextEntityChanged cachedDestroyEntity = Destorymover;
//        _gameContext.OnEntityWillBeDestroyed += cachedDestroyEntity;
        _movers = contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.Mover));
        _client = services.ClientSystem;
    }
 public StateFixSystem(Contexts contexts, Services services) : base(services.BackContext)
 {
     _context         = contexts.game;
     _backGameContext = services.BackContext;
     _client          = services.ClientSystem;
     _tmpGameContext  = new GameContext();
     _tmpGameContext.AddEntityIndex(new PrimaryEntityIndex <GameEntity, ushort>(
                                        "Id",
                                        _tmpGameContext.GetGroup(GameMatcher.Id),
                                        (e, c) => ((IdComponent)c).Value));
     serverBuffer = new BitBuffer(512);
     localBuffer  = new BitBuffer(512);
 }
Exemple #3
0
    public void StartClient()
    {
        if (Mode != Mode.Inactive)
        {
            throw new ApplicationException("Can't start client if already active.");
        }

        _client                    = new ClientNetworkSystem(_contexts);
        _client.TickRate           = (ushort)TargetTickPerSecond;
        _client.PanicStateCount    = PanicStateCount;
        _client.PanicCleanupTarget = PanicCleanupTarget;

        var services = new Services
        {
            ClientSystem = _client
        };

        _clientFeature = new ClientFeature(_contexts, services);
        Mode           = Mode.Client;
    }
    public void StartClient()
    {
        if (Mode != Mode.Inactive)
        {
            throw new ApplicationException("Can't start client if already active.");
        }

        _backGameContext = new GameContext();
        _backGameContext.AddEntityIndex(new Entitas.PrimaryEntityIndex <GameEntity, ushort>(
                                            "Id",
                                            _backGameContext.GetGroup(GameMatcher.Id),
                                            (e, c) => ((IdComponent)c).Value));

        if (Application.isPlaying)
        {
            var observer = new Entitas.VisualDebugging.Unity.ContextObserver(_backGameContext);
            observer.gameObject.name = "backGame";
            DontDestroyOnLoad(observer.gameObject);
        }

        _client = new ClientNetworkSystem(_contexts.game, _backGameContext)
        {
            TickRate           = (ushort)TargetTickPerSecond,
            PanicStateCount    = PanicStateCount,
            PanicCleanupTarget = PanicCleanupTarget
        };


        var services = new Services
        {
            ClientSystem = _client,
            BackContext  = _backGameContext
        };

        _clientFeature     = new ClientFeature(_contexts, services);
        _clientViewFeature = new ClientViewFeature(_contexts, services);
        Mode = Mode.Client;
    }
 public CommandMoveSystem(Contexts contexts, Services services) : base(contexts.input)
 {
     _movers      = contexts.game.GetGroup(GameMatcher.AllOf(GameMatcher.Mover));
     _gameContext = contexts.game;
     _client      = services.ClientSystem;
 }