Ejemplo n.º 1
0
 public void Activate(object value)
 {
     if (value is int)
     {
         NativeFlowNodeMethods.ActivateOutputInt(ParentNodePointer, PortId, System.Convert.ToInt32(value));
     }
     else if (value is float || value is double)
     {
         NativeFlowNodeMethods.ActivateOutputFloat(ParentNodePointer, PortId, System.Convert.ToSingle(value));
     }
     else if (value is EntityId)
     {
         NativeFlowNodeMethods.ActivateOutputEntityId(ParentNodePointer, PortId, (uint)((EntityId)(object)value)._value);
     }
     else if (value is string)
     {
         NativeFlowNodeMethods.ActivateOutputString(ParentNodePointer, PortId, System.Convert.ToString(value));
     }
     else if (value is bool)
     {
         NativeFlowNodeMethods.ActivateOutputBool(ParentNodePointer, PortId, System.Convert.ToBoolean(value));
     }
     else if (value is Vec3)
     {
         NativeFlowNodeMethods.ActivateOutputVec3(ParentNodePointer, PortId, (Vec3)(object)value);
     }
     else
     {
         throw new ArgumentException("Attempted to activate output with invalid value type!");
     }
 }
Ejemplo n.º 2
0
        protected T GetPortValue <T>(Action <T> port)
        {
            var type = typeof(T);

            if (type == typeof(int))
            {
                return((T)(object)NativeFlowNodeMethods.GetPortValueInt(Handle, GetInputPortId(port.Method)));
            }
            if (type == typeof(float))
            {
                return((T)(object)NativeFlowNodeMethods.GetPortValueFloat(Handle, GetInputPortId(port.Method)));
            }
            if (type == typeof(Vec3) || type == typeof(Color))
            {
                return((T)(object)NativeFlowNodeMethods.GetPortValueVec3(Handle, GetInputPortId(port.Method)));
            }
            if (type == typeof(string))
            {
                return((T)(object)NativeFlowNodeMethods.GetPortValueString(Handle, GetInputPortId(port.Method)));
            }
            if (type == typeof(bool))
            {
                return((T)(object)NativeFlowNodeMethods.GetPortValueBool(Handle, GetInputPortId(port.Method)));
            }
            if (type == typeof(EntityId))
            {
                return((T)(object)NativeFlowNodeMethods.GetPortValueEntityId(Handle, GetInputPortId(port.Method)));
            }
            if (type.IsEnum)
            {
                return((T)Enum.ToObject(typeof(T), NativeFlowNodeMethods.GetPortValueInt(Handle, GetInputPortId(port.Method))));
            }

            throw new ArgumentException("Invalid flownode port type specified!");
        }
Ejemplo n.º 3
0
 internal static void Register(string typeName)
 {
     NativeFlowNodeMethods.RegisterNode(typeName);
 }
Ejemplo n.º 4
0
 public void Activate(Vec3 value)
 {
     NativeFlowNodeMethods.ActivateOutputVec3(ParentNodePointer, PortId, value);
 }
Ejemplo n.º 5
0
 public void Activate(bool value)
 {
     NativeFlowNodeMethods.ActivateOutputBool(ParentNodePointer, PortId, value);
 }
Ejemplo n.º 6
0
 public void Activate(string value)
 {
     NativeFlowNodeMethods.ActivateOutputString(ParentNodePointer, PortId, value);
 }
Ejemplo n.º 7
0
 public void Activate(EntityId value)
 {
     NativeFlowNodeMethods.ActivateOutputEntityId(ParentNodePointer, PortId, value);
 }
Ejemplo n.º 8
0
 public void Activate(float value)
 {
     NativeFlowNodeMethods.ActivateOutputFloat(ParentNodePointer, PortId, value);
 }
Ejemplo n.º 9
0
 public void Activate()
 {
     NativeFlowNodeMethods.ActivateOutput(ParentNodePointer, PortId);
 }
Ejemplo n.º 10
0
 public bool IsActive()
 {
     return(NativeFlowNodeMethods.IsOutputConnected(ParentNodePointer, PortId));
 }
Ejemplo n.º 11
0
 protected bool IsPortActive <T>(Action <T> port)
 {
     return(NativeFlowNodeMethods.IsPortActive(Handle, GetInputPortId(port.Method)));
 }