public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var prefabEntity = conversionSystem.GetPrimaryEntity(prefab); ExplosionSystem.Initialize(prefabEntity); RenderExplosionSystem.Initialize(materialExplosion); }
protected override void OnCreate() { _query = GetEntityQuery(new EntityQueryDesc() { All = new ComponentType[] { ComponentType.ReadOnly <ExplosionComponent>(), }, }); _explosionSystem = World.GetOrCreateSystem <ExplosionSystem>(); _matricesInRenderer = new Matrix4x4[BatchNum][]; for (var i = 0; i < BatchNum; ++i) { _matricesInRenderer[i] = new Matrix4x4[Cv.InstanceLimit]; } }
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) { var entities = chunk.GetNativeArray(EntityType); var chunkTranslations = chunk.GetNativeArray(TranslationType); var chunkInfos = chunk.GetNativeArray(InfoType); for (var i = 0; i < chunk.Count; ++i) { ref var info = ref chunkInfos.AsReadOnlyRef(i); if (info.HitGeneration != 0) { var entity = entities[i]; CommandBuffer.DestroyEntity(chunkIndex, entity); ref var translation = ref chunkTranslations.AsReadOnlyRef(i); ExplosionSystem.Instantiate(CommandBuffer, chunkIndex /* jobIndex */, translation.Value, ExplosionPrefab, Time); }