Exemple #1
0
    protected override JobHandle OnUpdate(JobHandle inputDep)
    {
        var pongJob = new PongJob
        {
            driver = m_ServerDriverSystem.ConcurrentServerDriver
        };

        inputDep = pongJob.Schedule(this, inputDep);

        return(inputDep);
    }
    protected override JobHandle OnUpdate(JobHandle inputDep)
    {
        var pongJob = new PongJob
        {
            driver      = m_ServerDriverSystem.ServerDriver.ToConcurrent(),
            connections = connectionList.connections
        };

        inputDep = pongJob.Schedule(connectionList.connections.Length, 1, inputDep);

        return(inputDep);
    }
        // Schedule a pong job, which looks for pings and replies to them
        void SchedulePongJob()
        {
            var pongJob = new PongJob
            {
                // Check to see if we need to shut down after processing data
                shouldShutdown = m_ShouldShutdownServer,

                // PongJob is a ParallelFor job, it must use the concurrent NetworkDriver
                driver = m_ServerDriver.ToConcurrent(),

                // IJobParallelForDeferExtensions is not working correctly with IL2CPP
                connections = m_Connections
            };

            // PongJob uses IJobParallelForDeferExtensions, we *must* schedule with a list as first parameter rather than
            // an int since the job needs to pick up new connections from DriverUpdateJob
            // The PongJob is the last job in the chain and it must depends on the DriverUpdateJob
            m_UpdateHandle = pongJob.Schedule(m_UpdateHandle);
        }