// 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; }
void Start() { EModLibWrapper.InstantiateEx(); EModLibWrapper.createPersonEx(0); EModLibWrapper.inStimulusEx(0, 0.5, 0.5); EModLibWrapper.StartEx(); }
void Update() { if (!mStartedLib) { EModLibWrapper.StartEx(); mStartedLib = true; } }
// 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); }
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."); }
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."); } }
void Update() { print("Native random number " + EModLibWrapper.getEmotionEx(0)); }
void Awake() { EModLibWrapper.InstantiateEx(); }
void OnDestroy() { EModLibWrapper.StopEx(); }