public void Receive(Variable value, Input _input)
 {
     if (_input.InputId == 0)
     {
         torque = UnityObjectsConvertions.ConvertToVector3(value);
     }
 }
Example #2
0
        public void Receive(Ray value, Input _input)
        {
            if (_input.InputId == 0)
            {
                Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
            }

            if (_input.InputId == 1)
            {
                varName.Set(value.GetString());
            }

            if (_input.InputId == 2)
            {
                if (value.IsFloat())
                {
                    varValue.Set(value.GetFloat());
                    animator.SetFloat(varName.GetString(), varValue.GetFloat());
                }
                else
                {
                    Debug.LogWarning("Animator node only supports numbers");
                }
            }
        }
Example #3
0
        public void Receive(Ray _value, Input _input)
        {
            if (_input.InputId == 0)
            {
                if (_value.GetObject() == null)
                {
                    valueX.Value.Set(_value.GetFloat(0));
                    valueY.Value.Set(_value.GetFloat(1));
                    valueZ.Value.Set(_value.GetFloat(2));
                }
                else if (_value.GetObject() != null)
                {
                    var vector = UnityObjectsConvertions.ConvertToVector3(_value.GetObject());
                    valueX.Value.Set(vector.x);
                    valueY.Value.Set(vector.y);
                    valueZ.Value.Set(vector.z);
                }
            }

            if (_input.isBright)
            {
                sender.Send(valueX.Value, 0);
                sender.Send(valueY.Value, 1);
                sender.Send(valueZ.Value, 2);
            }
        }
        public void Receive(Ray value, Input _input)
        {
            if (_input.InputId == 1)
            {
                direction = gameObject.transform.TransformDirection(UnityObjectsConvertions.ConvertToVector3(value));
            }
            else if (_input.InputId == 0)
            {
                var obj = UnityObjectsConvertions.ConvertToGameObject(value.GetObject());
                if (obj is GameObject)
                {
                    Set(obj);
                }
            }

            if (_input.isBright)
            {
                Ray[] newVar = new Ray[3];
                newVar[0] = new Ray(direction.x);
                newVar[1] = new Ray(direction.y);
                newVar[2] = new Ray(direction.z);
                var Result = new Ray().Set(newVar);
                sender.Send(Result, 0);
            }
        }
Example #5
0
        public void Receive(Variable value, Input _input)
        {
            if (_input.InputId == 0)
            {
                Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
            }

            if (_input.InputId == 1)
            {
                movingVector = new Vector3(movingVector.x, movingVector.y, value.GetFloat());
            }

            if (_input.InputId == 2)
            {
                movingVector = new Vector3(value.GetFloat(), movingVector.y, movingVector.z);
            }

            if (_input.InputId == 3)
            {
                if (controller.isGrounded)
                {
                    movingVector = new Vector3(movingVector.x, value.GetFloat(), movingVector.z);
                }
            }

            if (_input.InputId == 4)
            {
                movingVector.y += UnityEngine.Physics.gravity.y * Time.deltaTime;
                controller.Move(movingVector);
                movingVector = Vector3.zero;
            }
        }
 public void Receive(Ray value, Input _input)
 {
     if (_input.InputId == 0)
     {
         Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
     }
     else
     {
         if (particleSystem != null)
         {
             var emission = particleSystem.emission;
             if (_input.InputId == 1)
             {
                 if (value.GetFloat() == 0)
                 {
                     emission.enabled = false;
                 }
                 else
                 {
                     emission.enabled = true;
                 }
                 //particleSystem.emission = emission;
             }
         }
     }
 }
Example #7
0
        public void Receive(Ray _value, Input _input)
        {
            if (_input.isBright)
            {
                if (GameObject.activeSelf == true)
                {
                    sender.Send(new Ray(1), 0);
                }
                else
                {
                    sender.Send(new Ray(0), 0);
                }
            }

            if (_input.InputId == 0)
            {
                GameObject = UnityObjectsConvertions.ConvertToGameObject(_value.GetObject());
            }

            if (_input.InputId == 1)
            {
                if (_value.GetFloat() == 1)
                {
                    GameObject.SetActive(true);
                }
                else
                {
                    GameObject.SetActive(false);
                }
            }
        }
Example #8
0
 public void Receive(Variable value, Input _input)
 {
     if (_input.InputId == 0)
     {
         Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
     }
 }
Example #9
0
        public void Receive(Ray value, Input _input)
        {
            if (_input.InputId == 0)
            {
                Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
            }

            if (slider == null)
            {
                Debug.LogWarning("No slider found could not update");
                return;
            }

            if (_input.InputId == 1)
            {
                slider.value = value.GetFloat();
            }

            if (_input.isBright)
            {
                sliderValue = new Ray(slider.value);
                sender.Send(new Ray().Set(slider), 0);
                sender.Send(sliderValue, 1);
            }
        }
Example #10
0
 public void Receive(Ray value, Input _input)
 {
     if (_input.InputId == 0)
     {
         Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
     }
     else if (_input.InputId == 1 && image != null)
     {
         var sprite = UnityObjectsConvertions.ConvertToSprite(value);
         if (sprite != null && image != null)
         {
             image.sprite = sprite;
         }
     }
     else if (_input.InputId == 2 && image != null)
     {
         ColorVar.Set(value.GetArray());
         image.color = new Color(ColorVar.GetArrayVariable(0).GetFloat(), ColorVar.GetArrayVariable(1).GetFloat(), ColorVar.GetArrayVariable(2).GetFloat(), ColorVar.GetArrayVariable(3).GetFloat());
     }
     else if (_input.isBright && image != null)
     {
         Ray[] newVar = new Ray[4];
         newVar[0] = new Ray().Set(image.color.r);
         newVar[1] = new Ray().Set(image.color.g);
         newVar[2] = new Ray().Set(image.color.b);
         newVar[3] = new Ray().Set(image.color.a);
         sender.Send(new Ray().Set(image.sprite), 0);
         sender.Send(new Ray().Set(new Ray().Set(newVar)), 1);
     }
 }
 public void Receive(Variable value, Input _input)
 {
     if (_input.InputId == 0)
     {
         if (!requestedForce)
         {
             force          = UnityObjectsConvertions.ConvertToVector3(value);
             requestedForce = true;
         }
     }
 }
Example #12
0
 public void Receive(Ray value, Input _input)
 {
     if (_input.InputId == 0)
     {
         Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
     }
     if (_input.InputId == 1)
     {
         text.text = value.GetString();
     }
 }
        public void Receive(Variable value, Input _input)
        {
            if (_input.InputId == 0)
            {
                rigidBody = UnityObjectsConvertions.ConvertToGameObject(value.GetObject()).GetComponent <UnityEngine.Rigidbody> () as UnityEngine.Rigidbody;
            }

            if (_input.InputId == 1)
            {
                isVelocityUpdated = false;
                force             = UnityObjectsConvertions.ConvertToVector3(value);
            }
        }
Example #14
0
        public void Receive(Variable _value, Input _input)
        {
            if (_input.InputId == 0)
            {
                gameObject = UnityObjectsConvertions.ConvertToGameObject(_value.GetObject());
            }

            if (_input.isWarm)
            {
                var component = gameObject.GetComponent(ComponentName.Value.GetString());
                componentObject.Set(component);
                sender.Send(componentObject, 0);
            }
        }
        public void Receive(Variable value, Input _input)
        {
            if (_input.InputId == 1)
            {
                Position.Set(value.GetArray());
                if (rigidBody == null || gameObject.activeInHierarchy == false)
                {
                    gameObject.transform.localPosition = new Vector3(Position.GetArrayVariable(0).GetFloat(), Position.GetArrayVariable(1).GetFloat(), Position.GetArrayVariable(2).GetFloat());
                }
                else
                {
                    rigidBody.position = new Vector3(Position.GetArrayVariable(0).GetFloat(), Position.GetArrayVariable(1).GetFloat(), Position.GetArrayVariable(2).GetFloat());
                }
            }
            else if (_input.InputId == 2)
            {
                Rotation.Set(value.GetArray());
                if (rigidBody == null)
                {
                    gameObject.transform.rotation = Quaternion.Euler(new Vector3(Rotation.GetArrayVariable(0).GetFloat(), Rotation.GetArrayVariable(1).GetFloat(), Rotation.GetArrayVariable(2).GetFloat()));
                }
                else
                {
                    rigidBody.rotation = Quaternion.Euler(new Vector3(Rotation.GetArrayVariable(0).GetFloat(), Rotation.GetArrayVariable(1).GetFloat(), Rotation.GetArrayVariable(2).GetFloat()));
                }
            }
            else if (_input.InputId == 3)
            {
                Scale.Set(value.GetArray());
                gameObject.transform.localScale = new Vector3(Scale.GetArrayVariable(0).GetFloat(), Scale.GetArrayVariable(1).GetFloat(), Scale.GetArrayVariable(2).GetFloat());
            }
            else if (_input.InputId == 0)
            {
                var obj = UnityObjectsConvertions.ConvertToGameObject(value.GetObject());
                if (obj is GameObject)
                {
                    Set(obj);
                }
            }

            if (_input.isWarm)
            {
                UpdateTransform();
                sender.Send(Position, 0);
                sender.Send(Rotation, 1);
                sender.Send(Scale, 2);
                sender.Send(GameObject, 3);
            }
        }
        void UpdateTransform()
        {
            gameObject = UnityObjectsConvertions.ConvertToGameObject(GameObject.GetObject()) as GameObject;
            Position.SetAtIndex(gameObject.transform.localPosition.x, 0);
            Position.SetAtIndex(gameObject.transform.localPosition.y, 1);
            Position.SetAtIndex(gameObject.transform.localPosition.z, 2);

            Rotation.SetAtIndex(gameObject.transform.rotation.eulerAngles.x, 0);
            Rotation.SetAtIndex(gameObject.transform.rotation.eulerAngles.y, 1);
            Rotation.SetAtIndex(gameObject.transform.rotation.eulerAngles.z, 2);

            Scale.SetAtIndex(gameObject.transform.localScale.x, 0);
            Scale.SetAtIndex(gameObject.transform.localScale.y, 1);
            Scale.SetAtIndex(gameObject.transform.localScale.z, 2);
        }
 public void Receive(Variable value, Input _input)
 {
     if (_input.InputId == 0)
     {
         var obj = UnityObjectsConvertions.ConvertToGameObject(value.GetObject());
         if (obj is GameObject)
         {
             Set(obj);
         }
     }
     else if (_input.InputId == 1)
     {
         var ConstellationBehaviour = gameObject.AddComponent(typeof(ConstellationBehaviour)) as ConstellationBehaviour;
         var constellationScript    = JsonUtility.FromJson <ConstellationScriptData>(value.GetString());
         ConstellationBehaviour.SetConstellation(constellationScript);
     }
 }
Example #18
0
 public void Receive(Ray value, Input _input)
 {
     if (_input.InputId == 0)
     {
         Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
     }
     else if (rigidBody != null)
     {
         if (_input.InputId == 1)
         {
             rigidBody.mass = value.GetFloat();
         }
         else if (_input.InputId == 2)
         {
             rigidBody.drag = value.GetFloat();
         }
         else if (_input.InputId == 3)
         {
             rigidBody.angularDrag = value.GetFloat();
         }
         else if (_input.InputId == 4)
         {
             if (value.GetFloat() == 1)
             {
                 rigidBody.useGravity = true;
             }
             else
             {
                 rigidBody.useGravity = false;
             }
         }
         else if (_input.InputId == 5)
         {
             if (value.GetFloat() == 1)
             {
                 rigidBody.isKinematic = true;
             }
             else
             {
                 rigidBody.isKinematic = false;
             }
         }
     }
 }
        //Receive from inputs.
        public void Receive(Variable _value, Input _input)
        {
            if (_input.InputId == 0)
            {
                var newGameObject = UnityObjectsConvertions.ConvertToGameObject(_value.GetObject());
                if (newGameObject != null)
                {
                    var newAudioSource = newGameObject.GetComponent <UnityEngine.AudioSource> () as UnityEngine.AudioSource;
                    if (audioSource != null)
                    {
                        audioSource = newAudioSource;
                    }
                }
            }

            if (_input.InputId == 1 && audioSource != null)
            {
                audioSource.Play();
            }
        }
Example #20
0
 public void Receive(Ray value, Input _input)
 {
     if (_input.InputId == 1)
     {
         if (!requestedForce)
         {
             force          = UnityObjectsConvertions.ConvertToVector3(value);
             requestedForce = true;
         }
     }
     else if (_input.InputId == 0)
     {
         var obj = UnityObjectsConvertions.ConvertToGameObject(value.GetObject());
         if (obj is GameObject)
         {
             Set(obj);
             SetRigidBody();
         }
     }
 }
Example #21
0
        public void Receive(Variable value, Input _input)
        {
            if (_input.InputId == 0)
            {
                if (value.GetObject() == null)
                {
                    var vector = new Vector3(value.GetFloat(0), value.GetFloat(1), value.GetFloat(2));
                    gameobjectPosition = vector;
                }
                else if (value.GetObject() != null)
                {
                    var vector = UnityObjectsConvertions.ConvertToVector3(value.GetObject());
                    gameobjectPosition = vector;
                }
            }

            if (_input.InputId == 1)
            {
                if (value.GetObject() == null)
                {
                    var vector = new Vector3(value.GetFloat(0), value.GetFloat(1), value.GetFloat(2));
                    targetPosition = vector;
                }
                else if (value.GetObject() != null)
                {
                    var vector = UnityObjectsConvertions.ConvertToVector3(value.GetObject());
                    targetPosition = vector;
                }
            }

            if (_input.isWarm)
            {
                var        targetRotation = Quaternion.LookRotation(targetPosition - gameobjectPosition).eulerAngles;
                Variable[] newVar         = new Variable[3];
                newVar[0]      = new Variable(targetRotation.x);
                newVar[1]      = new Variable(targetRotation.y);
                newVar[2]      = new Variable(targetRotation.z);
                ResultRotation = new Variable().Set(newVar);
                sender.Send(ResultRotation, 0);
            }
        }
        public void Receive(Variable value, Input _input)
        {
            if (_input.InputId == 0)
            {
                Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
            }

            if (_input.InputId == 1)
            {
                if (slider == null)
                {
                    AddSlider();
                }
                slider.value = value.GetFloat();
            }

            if (_input.isWarm)
            {
                sliderValue = new Variable(slider.value);
                sender.Send(sliderValue, 0);
            }
        }
Example #23
0
        public void Receive(Variable value, Input _input)
        {
            if (_input.InputId == 0)
            {
                Set(UnityObjectsConvertions.ConvertToGameObject(value.GetObject()));
            }

            if (_input.InputId == 1)
            {
                var sprite = UnityObjectsConvertions.ConvertToSprite(value);
                if (sprite != null)
                {
                    image.sprite = sprite;
                }
            }

            if (_input.InputId == 2)
            {
                ColorVar.Set(value.GetArray());
                image.color = new Color(ColorVar.GetArrayVariable(0).GetFloat() * 0.01f, ColorVar.GetArrayVariable(1).GetFloat() * 0.01f, ColorVar.GetArrayVariable(2).GetFloat() * 0.01f, ColorVar.GetArrayVariable(3).GetFloat() * 0.01f);
            }
        }
        public void Receive(Variable value, Input _input)
        {
            if (_input.InputId == 0)
            {
                var gameObject = UnityObjectsConvertions.ConvertToGameObject(value.GetObject());
                if (gameObject != null)
                {
                    renderer = gameObject.GetComponent <Renderer> ();
                }
            }

            if (renderer == null)
            {
                return;
            }

            if (_input.isWarm)
            {
                color = new UnityEngine.Color(value.GetArrayVariable(0).GetFloat(), value.GetArrayVariable(1).GetFloat(), value.GetArrayVariable(2).GetFloat(), value.GetArrayVariable(3).GetFloat());
                renderer.material.color = color;
            }
        }