protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //
            inputDeps = new AddJob
            {
                NetworkHeartbeat = typeof(NetworkHeartbeat),
                commandBuffer    = endBarrier.CreateCommandBuffer().ToConcurrent(),
            }
            .Schedule(this, inputDeps);



            //
            using (var commandBuffer = new SampleCommandBuffer <NetworkDisconnectedMessage>(Allocator.TempJob))
            {
                inputDeps = new Heartbeat2CJob
                {
                    commandBuffer    = commandBuffer.ToConcurrent(),
                    fixedDeltaTime   = Time.fixedDeltaTime,
                    disconnectedTime = disconnectedTime,
                }
                .Schedule(this, inputDeps);

                inputDeps.Complete();
                commandBuffer.Playback(EntityManager);
            }


            //endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }
Example #2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            SampleCommandBuffer <NetworkId> commandBuffer = new SampleCommandBuffer <NetworkId>(Allocator.TempJob);

            inputDeps = new AddNetworkIdJob
            {
                commandBuffer = commandBuffer.ToConcurrent(),
            }
            .Schedule(this, inputDeps);

            inputDeps.Complete();
            commandBuffer.Playback(EntityManager);
            commandBuffer.Dispose();

            return(inputDeps);
        }
Example #3
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //
            if (enterGameQuery.IsEmptyIgnoreFilter == false)
            {
                EntityManager.AddComponent <PlayerShipMoveInputNetMessage>(enterGameQuery);
                EntityManager.AddComponent <PlayerShipFireInputNetMessage>(enterGameQuery);
            }

            //
            inputDeps = base.OnUpdate(inputDeps);


            //
            using (var moveInputCommandBuffer = new SampleCommandBuffer <ShipMoveInput>(Allocator.TempJob))
                using (var weaponInputCommandBuffer = new SampleCommandBuffer <WeaponInput>(Allocator.TempJob))
                {
                    var inputDepsA = new MoveInputJob
                    {
                        shipDisableMoveInputFromEntity = GetComponentDataFromEntity <ShipLostInputState>(true),

                        moveInputCommandBuffer = moveInputCommandBuffer.ToConcurrent(),
                    }
                    .Schedule(this, inputDeps);

                    var inputDepsB = new FireInputJob
                    {
                        shipDisableFireInputFromEntity = GetComponentDataFromEntity <ShipLostInputState>(true),

                        weaponInstalledStateFromEntity = GetComponentDataFromEntity <WeaponInstalledState>(true),
                        weaponControlFromEntity        = GetComponentDataFromEntity <WeaponControl>(true),

                        translationFromEntity = GetComponentDataFromEntity <Translation>(true),
                        rotationFromEntity    = GetComponentDataFromEntity <Rotation>(true),

                        weaponInputCommandBuffer = weaponInputCommandBuffer.ToConcurrent(),
                    }
                    .Schedule(this, inputDeps);

                    moveInputCommandBuffer.Playback(EntityManager, inputDepsA);
                    weaponInputCommandBuffer.Playback(EntityManager, inputDepsB);
                }

            return(inputDeps);
        }
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            //
            using (var commandBuffer = new EntityCommandBuffer(Allocator.TempJob))
                using (var endCommandBuffer = new SampleCommandBuffer <NetworkDisconnectedMessage>(Allocator.TempJob))
                {
                    inputDeps = new ReceiveJob()
                    {
                        NetworkConnectedMessage = typeof(NetworkConnectedMessage),
                        driver           = networkStreamSystem.concurrentDriver,
                        commandBuffer    = commandBuffer.ToConcurrent(),
                        endCommandBuffer = endCommandBuffer.ToConcurrent(),
                    }
                    .Schedule(this, inputDeps);

                    inputDeps.Complete();
                    commandBuffer.Playback(EntityManager);
                    endCommandBuffer.Playback(endBarrier);
                }

            //endBarrier.AddJobHandleForProducer(inputDeps);
            return(inputDeps);
        }