protected override JobHandle OnUpdate(JobHandle inputDeps) { //Timer specific var startTimerJob = new StartTimerJob(); var handle = startTimerJob.Schedule(inputDeps); //Timer specific EntityQuery query = GetEntityQuery(typeof(Velocity), ComponentType.ReadOnly <Translation>(), ComponentType.ReadOnly <ORCATag>()); ArchetypeChunkComponentType <Translation> translationChunk = GetArchetypeChunkComponentType <Translation>(true); ArchetypeChunkComponentType <Velocity> velocityChunk = GetArchetypeChunkComponentType <Velocity>(false); ORCAJob orcaJob = new ORCAJob { translationType = translationChunk, velocityType = velocityChunk, quadrantMap = QuadrantSystem.quadrantMultiHashMap, maxNeighbors = Blackboard.Instance.MaxNeighbors, neighborsDist = Blackboard.Instance.NeighborsDist, radius = Blackboard.Instance.Radius, invTimeHorizon = 1.0f / Blackboard.Instance.TimeHorizon, dt = UnityEngine.Time.deltaTime, }; var handle2 = orcaJob.Schedule(query, handle); //Timer specific var endTimerJob = new EndTimerJob(); timerRecoder.RegisterTimeInMS(time); //Timer specific return(endTimerJob.Schedule(handle2)); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { //Timer specific var startTimerJob = new StartTimerJob(); var handle = startTimerJob.Schedule(inputDeps); //Timer specific if (_waypointGraph == null) { _waypointGraph = WaypointGraph.Instance; } EntityQuery query = GetEntityQuery(ComponentType.ReadOnly(typeof(PathFindingRequest))); if (query.CalculateEntityCount() == 0) { //Timer specific var endTimerJob2 = new EndTimerJob(); timerRecoder.RegisterTimeInMS(time); //Timer specific return(endTimerJob2.Schedule(handle)); } ArchetypeChunkBufferType <PathPositions> pathPositionBufferChunk = GetArchetypeChunkBufferType <PathPositions>(); ArchetypeChunkComponentType <PathFindingRequest> pathFindingRequestChunk = GetArchetypeChunkComponentType <PathFindingRequest>(true); ArchetypeChunkComponentType <PathIndex> pathIndexChunk = GetArchetypeChunkComponentType <PathIndex>(); //Update quadrants data FindPathJob2 findPathJob = new FindPathJob2() { waypoints = _waypointGraph.Waypoints, Neighbors = _waypointGraph.Neighbors, pathFindingRequestType = pathFindingRequestChunk, pathPositionType = pathPositionBufferChunk, pathIndexType = pathIndexChunk }; var handle2 = findPathJob.Schedule(query, handle); //Timer specific var endTimerJob = new EndTimerJob(); timerRecoder.RegisterTimeInMS(time); //Timer specific return(endTimerJob.Schedule(handle2)); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { //Timer specific var startTimerJob = new StartTimerJob(); var handle = startTimerJob.Schedule(inputDeps); //Timer specific EntityQuery query = GetEntityQuery(typeof(Translation), typeof(Velocity)); quadrantMultiHashMap.Clear(); if (query.CalculateEntityCount() > quadrantMultiHashMap.Capacity) { quadrantMultiHashMap.Capacity = query.CalculateEntityCount(); } ArchetypeChunkComponentType <Translation> translationChunk = GetArchetypeChunkComponentType <Translation>(true); ArchetypeChunkComponentType <Velocity> velocityChunk = GetArchetypeChunkComponentType <Velocity>(true); //Update quadrants data SetQuadrantDataJob setQuadrantData = new SetQuadrantDataJob() { translationType = translationChunk, velocityType = velocityChunk, quadrantHashMap = quadrantMultiHashMap.AsParallelWriter() }; var handle2 = setQuadrantData.Schedule(query, handle); //Timer specific var endTimerJob = new EndTimerJob(); timerRecoder.RegisterTimeInMS(time); //Timer specific return(endTimerJob.Schedule(handle2)); }
public static IJob Create(string[] args) { var startTimerJob = new StartTimerJob(); var items = new ItemIterator(args); while (items.MoveNext()) { switch (items.Value) { case "--help": return(new ShowHelpJob()); case "--timer": if (!items.MoveNext()) { return(new ShowMissingParameterJob("--timer")); } int length; if (!int.TryParse(items.Value, out length)) { return(new ShowIncorrentIntFormatJob("--timer")); } startTimerJob.TimerLengthInMinues = length; break; case "--silent": startTimerJob.Silent = true; break; default: return(new ShowUnknownParameterJob(items.Value)); } } return(startTimerJob); }