コード例 #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;
    }
コード例 #2
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.");
     }
 }