// Update is called once per frame void Update() { GameClass.ChangeDzen(.05F * Time.deltaTime); if (Input.GetKey("up")) { GetComponent <Rigidbody>() .MovePosition(gameObject.GetComponent <Rigidbody>().position + new Vector3(0, yogaSpeed, 0) * Time.deltaTime); GameClass.ChangeDzen(-1.0F * Time.deltaTime); } if (Input.GetKey("right")) { GetComponent <Rigidbody>() .MovePosition(gameObject.GetComponent <Rigidbody>().position + new Vector3(yogaSpeed, 0, 0) * Time.deltaTime); GameClass.ChangeDzen(-1.0F * Time.deltaTime); } if (Input.GetKey("down")) { GetComponent <Rigidbody>() .MovePosition(gameObject.GetComponent <Rigidbody>().position + new Vector3(0, -1.0F * yogaSpeed, 0) * Time.deltaTime); GameClass.ChangeDzen(-1.0F * Time.deltaTime); } if (Input.GetKey("left")) { GetComponent <Rigidbody>() .MovePosition(gameObject.GetComponent <Rigidbody>().position + new Vector3(-1.0F * yogaSpeed, 0, 0) * Time.deltaTime); GameClass.ChangeDzen(-1.0F * Time.deltaTime); } }
void OnTriggerEnter(Collider other) { GameClass.ChangeDzen(-10.0F * Time.deltaTime); }