protected override JobHandle OnUpdate(JobHandle inputDeps) { var board = m_BoardQuery.GetSingleton <LbBoard>(); var entitiesSpawners = m_ArrowSpawerQuery.ToEntityArray(Allocator.TempJob); var entitiesArrows = m_ArrowsQuery.ToEntityArray(Allocator.TempJob); var arrowSpawners = m_ArrowSpawerQuery.ToComponentDataArray <LbArrowSpawner>(Allocator.TempJob); var boardEntity = m_BoardQuery.GetSingletonEntity(); var arrowsQuery = m_ArrowsQuery.ToComponentDataArray <LbArrow>(Allocator.TempJob); var bufferLookup = GetBufferFromEntity <LbArrowDirectionMap>(); var buffer = bufferLookup[boardEntity]; var bufferArray = buffer.AsNativeArray(); var commandBuffer = m_EntityCommandBufferSystem.CreateCommandBuffer(); var handle = new MemsetNativeArray <LbArrowDirectionMap>() { Source = bufferArray, Value = new LbArrowDirectionMap() }.Schedule(bufferArray.Length, bufferArray.Length, inputDeps); handle = new SpawnArrow { Entities = entitiesSpawners, ArrowSpawners = arrowSpawners, CommandBuffer = commandBuffer }.Schedule(handle); handle = new WriteArroMap { Size = board.SizeY, Entities = entitiesArrows, LbArrows = arrowsQuery, ArrowDirectionMap = bufferArray, }.Schedule(handle); m_EntityCommandBufferSystem.AddJobHandleForProducer(handle); return(handle); }
public void SetPlayer(Player _player) { player = _player; spawnArrow = player.GetComponent <SpawnArrow>(); }