protected override void OnUpdate()
    {
        var translationTypeHandle = GetComponentTypeHandle <Translation>();

        var job = new OscillateJob
        {
            time = (float)Time.ElapsedTime,
            translationTypeHandle = translationTypeHandle,
        };

        Dependency = job.ScheduleSingle(m_OscillateGroup, Dependency);
    }
Ejemplo n.º 2
0
    protected override void OnUpdate()
    {
        var oscillateManager = GetSingletonEntity <Oscillate>();
        var oscillateBuffer  = GetBuffer <Oscillate>(oscillateManager);

        oscillateBufferCache.Clear();
        oscillateBufferCache.CopyFrom(oscillateBuffer.AsNativeArray());

        var translationLookup = GetComponentDataFromEntity <Translation>(false);

        var job = new OscillateJob
        {
            time = (float)Time.ElapsedTime,

            oscillateBuffer = oscillateBufferCache,

            translationLookup = translationLookup
        };

        var innerLoopBatchCount = (int)math.floor(math.sqrt((float)oscillateBufferCache.Length));

        Dependency = job.Schedule(oscillateBufferCache.Length, innerLoopBatchCount, Dependency);
    }