protected override void AllocateData(ref BlobBuilder builder, ref BlobVariable <T> blobVariable, INodeDataBuilder self, ITreeNode <INodeDataBuilder>[] tree)
 {
     if (_useRef)
     {
         builder.Allocate(ref blobVariable, new ComponentVariableProperty <T> .DynamicComponentData {
             StableHash = _stableHash, Offset = _offset
         });
     }
     else
     {
         builder.Allocate(ref blobVariable, new ComponentVariableProperty <T> .CopyToLocalComponentData {
             StableHash = _stableHash, Offset = _offset, LocalValue = default
         });
Example #2
0
        protected override void AllocateData(ref BlobBuilder builder, ref BlobVariable <T> blobVariable)
        {
            var data = Utility.GetTypeHashAndFieldOffset(ComponentValueName);

            if (data.Type != typeof(T) || data.Hash == 0)
            {
                Debug.LogError($"ComponentVariable({ComponentValueName}) is not valid, fallback to ConstantValue");
                builder.Allocate(ref blobVariable, FallbackValue);
                return;
            }
            builder.Allocate(ref blobVariable, new DynamicComponentData {
                StableHash = data.Hash, Offset = data.Offset
            });
        }
Example #3
0
        protected override void AllocateData(ref BlobBuilder builder, ref BlobVariable <T> blobVariable)
        {
            FieldInfo fieldInfo = null;

            if (ScriptableObject != null)
            {
                fieldInfo = ScriptableObject.GetType().GetField(ScriptableObjectValueName, FIELD_BINDING_FLAGS);
            }

            if (fieldInfo == null || fieldInfo.FieldType != typeof(T))
            {
                Debug.LogError($"{ScriptableObject.name}.{ScriptableObjectValueName} is not valid, fallback to ConstantValue");
                builder.Allocate(ref blobVariable, FallbackValue);
                return;
            }

            builder.Allocate(ref blobVariable, (T)fieldInfo.GetValue(ScriptableObject));
        }
Example #4
0
 private static ref T GetDataRef(ref BlobVariable <T> blobVariable, int index, INodeBlob blob, IBlackboard bb)
 {
     return(ref blobVariable.Value <T>());
 }
Example #5
0
 private static unsafe T GetData <TNodeBlob, TBlackboard>(ref BlobVariable <T> blobVariable, int index, ref TNodeBlob blob, ref TBlackboard bb)
     where TNodeBlob : struct, INodeBlob
     where TBlackboard : struct, IBlackboard
 {
     ref var port         = ref blobVariable.Value <InputDataPort>();
Example #6
0
 protected override void AllocateData(ref BlobBuilder builder, ref BlobVariable <T> blobVariable, INodeDataBuilder self, ITreeNode <INodeDataBuilder>[] tree)
 {
     builder.Allocate(ref blobVariable, _port);
 }
Example #7
0
 private static T GetData(ref BlobVariable <T> blobVariable, int index, INodeBlob blob, IBlackboard bb)
 {
     ref var data = ref blobVariable.Value <DynamicComponentData>();