protected override JobHandle OnUpdate(JobHandle inputDeps) { //this could be set once per environment run NativeArray <Entity> prefabArray = GetEntityQuery( ComponentType.ReadOnly <TxAutotroph>(), ComponentType.ReadOnly <Prefab>() ).ToEntityArray(Allocator.TempJob); NativeArray <Entity> prefabPollenArray = GetEntityQuery( ComponentType.ReadOnly <TxAutotrophPollen>(), ComponentType.ReadOnly <Prefab>() ).ToEntityArray(Allocator.TempJob); NativeArray <Entity> prefabPetalArray = GetEntityQuery( ComponentType.ReadOnly <TxAutotrophPetalMeshFlag>(), ComponentType.ReadOnly <Prefab>() ).ToEntityArray(Allocator.TempJob); var jobDeps = inputDeps; if (prefabArray.Length > 0) { prefabEntity = prefabArray[0]; prefabPollenEntity = prefabPollenArray[0]; prefabPetalEntity = prefabPetalArray[0]; var ecb = m_EndSimulationEcbSystem.CreateCommandBuffer().ToConcurrent(); Sprout job = new Sprout() { environmentSettings = Environment.environmentSettings, ecb = ecb, prefabEntity = prefabEntity, prefabPollenEntity = prefabPollenEntity, prefabPetalEntity = prefabPetalEntity, //txAutotrophChrome1ABCD = GetComponentDataFromEntity<TxAutotrophChrome1AB>(), //txAutotrophPollenCD = GetComponentDataFromEntity<TxAutotrophPollen>() }; JobHandle jobHandle = job.Schedule(m_Group, inputDeps); //Schedule(m_Group, inputDeps); m_EndSimulationEcbSystem.AddJobHandleForProducer(jobHandle); jobHandle.Complete(); jobDeps = jobHandle; } prefabArray.Dispose(); prefabPollenArray.Dispose(); prefabPetalArray.Dispose(); return(jobDeps); }
void Start() { parent = gameObject.GetComponentInParent <Sprout>(); max = parent.lives; localScale = transform.localScale; }