您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
45 行
936 B
45 行
936 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using System.Linq;
|
|
using Unity.Jobs;
|
|
using Unity.Collections;
|
|
// using Unity.Entities;
|
|
|
|
namespace GraphProcessor
|
|
{
|
|
|
|
/// <summary>
|
|
/// Graph processor
|
|
/// </summary>
|
|
public class ProcessGraphProcessor : BaseGraphProcessor
|
|
{
|
|
List< BaseNode > processList;
|
|
|
|
/// <summary>
|
|
/// Manage graph scheduling and processing
|
|
/// </summary>
|
|
/// <param name="graph">Graph to be processed</param>
|
|
public ProcessGraphProcessor(BaseGraph graph) : base(graph) {}
|
|
|
|
public override void UpdateComputeOrder()
|
|
{
|
|
processList = graph.nodes.OrderBy(n => n.computeOrder).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Schedule the graph into the job system
|
|
/// </summary>
|
|
public override void Run()
|
|
{
|
|
int count = processList.Count;
|
|
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
processList[i].OnProcess();
|
|
}
|
|
|
|
JobHandle.ScheduleBatchedJobs();
|
|
}
|
|
}
|
|
}
|