Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 5
0
 public static unsafe ref T GetNodeData <T>(this INodeBlob blob, int index) where T : struct
 {
     return(ref UnsafeUtilityEx.AsRef <T>((void *)blob.GetRuntimeDataPtr(index)));
 }
Exemplo n.º 6
0
 public static IntPtr GetNodeDataPtr(this INodeBlob blob, int index)
 {
     return(blob.GetRuntimeDataPtr(index));
 }