コード例 #1
0
ファイル: AddNode.cs プロジェクト: r2d2m/NodeGame
 protected override void ProcessInputs(out bool processAllOutputs)
 {
     if (in1.GetDataType() == typeof(Vector2))
     {
         //vec2
         Vector2 vec1 = (Vector2)in1.GetData();
         Vector2 vec2 = (Vector2)in2.GetData();
         outp.SetData(Vec2Operation(vec1, vec2));
     }
     else if (in1.GetDataType() == typeof(Vector3))
     {
         //vec3
         Vector3 vec1 = (Vector3)in1.GetData();
         Vector3 vec2 = (Vector3)in2.GetData();
         outp.SetData(Vec3Operation(vec1, vec2));
     }
     else if (in1.GetDataType() == typeof(float))
     {
         //float
         float f1 = (float)in1.GetData();
         float f2 = (float)in2.GetData();
         outp.SetData(FloatOperation(f1, f2));
     }
     else
     {
         Debug.LogError("type f****d in the butt, this shouldn't happen (AddNode)");
     }
     processAllOutputs = true;
 }
コード例 #2
0
 protected override void ProcessInputs(out bool processAllOutputs)
 {
     if (in1.GetDataType() == typeof(float))
     {
         //multiply 2 float
         float v = (float)in1.GetData();
         float m = (float)inMult.GetData();
         outResult.SetData(v * m);
     }
     else if (in1.GetDataType() == typeof(Vector2))
     {
         //multiply vector2 and float
         Vector2 v = (Vector2)in1.GetData();
         float   m = (float)inMult.GetData();
         outResult.SetData(v * m);
     }
     else if (in1.GetDataType() == typeof(Vector3))
     {
         //multiply vec3 and float
         Vector3 v = (Vector3)in1.GetData();
         float   m = (float)inMult.GetData();
         outResult.SetData(v * m);
     }
     processAllOutputs = true;
 }
コード例 #3
0
 protected override void OnUpdate()
 {
     if (!hasProcessedThisFrame)
     {
         if (checkManuallyX || checkManuallyY || checkManuallyZ)
         {
             //if any of the inputs are not filled
             if (!checkManuallyX && inX.hasData)
             {
                 //there is smtg plugged in X
                 data.x      = (float)inX.GetData();
                 inX.hasData = false;
             }
             if (!checkManuallyY && inY.hasData)
             {
                 //there is smtg plugged in Y
                 data.y      = (float)inY.GetData();
                 inY.hasData = false;
             }
             if (!checkManuallyZ && inZ.hasData)
             {
                 data.z      = (float)inZ.GetData();
                 inZ.hasData = false;
             }
         }
         outputs[0].SetData(data.ToVector());
         ProcessAllOutputs();
     }
     hasProcessedThisFrame = false;
 }
コード例 #4
0
 protected override void ProcessInputs(out bool processAllOutputs)
 {
     if (in1.GetDataType() == typeof(Vector2))
     {
         //vector2
         Vector2 vect = (Vector2)in1.GetData();
         x.SetData(vect.x);
         y.SetData(vect.y);
         magn.SetData(vect.magnitude);
     }
     else
     {
         //vector3
         Vector3 vect = (Vector3)in1.GetData();
         x.SetData(vect.x);
         y.SetData(vect.y);
         z.SetData(vect.z);
         magn.SetData(vect.magnitude);
     }
     processAllOutputs = true;
 }
コード例 #5
0
ファイル: WaitNode.cs プロジェクト: r2d2m/NodeGame
 protected override void ProcessInputs(out bool processAllOutputs)
 {
     if (!waiting)
     {
         //we know the input has data so we can start waiting now
         waitTime    = (float)inTime.GetData();
         waiting     = true;
         startTime   = Time.time;
         savedDataIn = input.GetData();
         //save the data, wait some time and put the data on the output,
         //if this is a flow a data the data is gonna be offset by some time
     }
     processAllOutputs = false;
 }
コード例 #6
0
 protected override void ProcessInputs(out bool processAllOutputs)
 {
     variables[varName].SetData(inp.GetData());
     processAllOutputs = false;
 }