Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }

        //Set the main Color of the Material to valence
        double valence = EModLibWrapper.getValenceEx(mPersonId);

        //rend.material.shader = Shader.Find("_Color");

        if (valence > 0.1)
        {
            //rend.material.SetColor("_Color", Color.blue);
            mMaterial.color = new Color(0.0f, 0.0f, 1.0f);
        }
        else if (valence < -0.1)
        {
            //rend.material.SetColor("_Color", Color.red);
            //mMaterial.color = Color.red;
            mMaterial.color = new Color(1.0f, 0.0f, 0.0f);
        }
        else
        {
            mMaterial.color = new Color(0.0f, 1.0f, 0.0f);
        }

        rb.drag = (float)EModLibWrapper.getValenceEx(mPersonId) + 1.0f;
    }
Example #2
0
 void Start()
 {
     EModLibWrapper.InstantiateEx();
     EModLibWrapper.createPersonEx(0);
     EModLibWrapper.inStimulusEx(0, 0.5, 0.5);
     EModLibWrapper.StartEx();
 }
Example #3
0
 void Update()
 {
     if (!mStartedLib)
     {
         EModLibWrapper.StartEx();
         mStartedLib = true;
     }
 }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     rb   = GetComponent <Rigidbody>();
     rend = GetComponent <Renderer>();
     //Fetch the Material from the Renderer of the GameObject
     mMaterial = GetComponent <Renderer>().material;
     clickTime = 0.0f;
     count     = 0;
     SetCountText();
     winText.text = "";
     mPersonId    = EModLibWrapper.createPersonEx(0);
     Debug.Log("PersonID " + mPersonId);
 }
Example #5
0
    void OnMouseUp()
    {
        float arousal = Time.time - clickTime;

        mFlipArousal *= -1;
        if (Input.GetMouseButtonUp(0))
        {
            EModLibWrapper.inStimulusEx(mPersonId, arousal * mFlipArousal, Random.Range(-1.0f, 1.0f));
            Debug.Log("Stimulus: " + arousal + " random valence");
        }

        rb.AddForce(movement * thrust * arousal);
        Debug.Log("Pressed mouse up button.");
    }
Example #6
0
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.CompareTag("NegativeWall") && (EModLibWrapper.getValenceEx(mPersonId) < -0.1))
     {
         gameObject.SetActive(false);
         count++;
         SetCountText();
         Debug.Log("Collision.");
     }
     else if (other.gameObject.CompareTag("PositiveWall") && (EModLibWrapper.getValenceEx(mPersonId) > 0.1))
     {
         gameObject.SetActive(false);
         count++;
         SetCountText();
         Debug.Log("Collision.");
     }
     else if (other.gameObject.CompareTag("NeutralWall") && (EModLibWrapper.getValenceEx(mPersonId) > -0.1) && (EModLibWrapper.getValenceEx(mPersonId) < 0.1))
     {
         gameObject.SetActive(false);
         count++;
         SetCountText();
         Debug.Log("Collision.");
     }
 }
Example #7
0
 void Update()
 {
     print("Native random number " + EModLibWrapper.getEmotionEx(0));
 }
Example #8
0
 void Awake()
 {
     EModLibWrapper.InstantiateEx();
 }
Example #9
0
 void OnDestroy()
 {
     EModLibWrapper.StopEx();
 }