public static unsafe void ResetRuntimeData(this INodeBlob blob, int index, int count = 1) { var dest = (void *)blob.GetRuntimeDataPtr(index); var src = (void *)blob.GetDefaultDataPtr(index); UnsafeUtility.MemCpy(dest, src, blob.GetNodeDataSize(index, count)); }
public static IEnumerable <ComponentType> GetAccessTypes(int index, INodeBlob blob) { var typeId = blob.GetTypeId(index); var ptr = blob.GetRuntimeDataPtr(index); var node = MetaNodeRegister.NODES[typeId]; var runtimeTypes = node.RuntimeTypes.SelectMany(r => r.Func.Invoke(ptr + r.Offset)); return(node.StaticTypes.Concat(runtimeTypes)); }
public static NodeState Tick(int index, INodeBlob blob, IBlackboard bb) { var typeId = blob.GetTypeId(index); var ptr = blob.GetRuntimeDataPtr(index); var state = MetaNodeRegister.NODES[typeId].Tick.Invoke(ptr, index, blob, bb); blob.SetState(index, state); return(state); }
public static void Reset(int fromIndex, INodeBlob blob, IBlackboard bb, int count = 1) { blob.ResetStates(fromIndex, count); blob.ResetRuntimeData(fromIndex, count); for (var i = fromIndex; i < fromIndex + count; i++) { var typeId = blob.GetTypeId(i); var ptr = blob.GetRuntimeDataPtr(i); MetaNodeRegister.NODES[typeId].Reset.Invoke(ptr, i, blob, bb); } }
public static unsafe ref T GetNodeData <T>(this INodeBlob blob, int index) where T : struct { return(ref UnsafeUtilityEx.AsRef <T>((void *)blob.GetRuntimeDataPtr(index))); }
public static IntPtr GetNodeDataPtr(this INodeBlob blob, int index) { return(blob.GetRuntimeDataPtr(index)); }