void FixedUpdate() { if (myControlerManager.getAwake() && Input.anyKeyDown && !Input.GetKey(KeyCode.Space) && !back && !push) { push = true; lerpTimerStart(); lerpTimerReset(); } if (push) { transform.position = Vector3.Lerp(orgPos, newPos, lerpTimer); if (lerpTimer > 1) { push = false; back = true; lerpTimerReset(); } } if (back) { transform.position = Vector3.Lerp(newPos, orgPos, lerpTimer); if (lerpTimer > 1) { back = false; lerpTimerOff(); } } }
void FixedUpdate() { v = thisRigidBody.velocity; if (myControlerManager.getAwake() && Input.GetKeyDown(KeyCode.RightArrow) && v.x > -0.5 && v.y > -0.5 && v.z > -0.5) { thisRigidBody.AddForce(transform.forward * forceMultiplier, ForceMode.Impulse); sfx.Play(); Debug.Log("R"); } if (myControlerManager.getAwake() && Input.GetKeyDown(KeyCode.LeftArrow) && v.x < 0.5 && v.y < 0.5 && v.z < 0.5) { thisRigidBody.AddForce(-transform.forward * forceMultiplier, ForceMode.Impulse); sfx.Play(); Debug.Log("L"); } }
void FixedUpdate() { v = thisRigidBody.velocity; if (v.x > maxV) { v.x = maxV; } else if (v.x < -maxV) { v.x = -maxV; } if (v.y > maxV) { v.y = maxV; } else if (v.y < -maxV) { v.y = -maxV; } if (v.z > maxV) { v.z = maxV; } else if (v.z < -maxV) { v.z = -maxV; } if (myControlerManager.getAwake() && Input.GetKeyDown(KeyCode.RightArrow)) { thisRigidBody.AddForce(-Vector3.right * forceMultiplier, ForceMode.Impulse); } if (myControlerManager.getAwake() && Input.GetKeyDown(KeyCode.LeftArrow)) { thisRigidBody.AddForce(Vector3.right * forceMultiplier, ForceMode.Impulse); } if (myControlerManager.getAwake() && Input.GetKeyDown(KeyCode.UpArrow) && v.x < 0.7 && v.y < 0.0 && v.z < 0.7) { thisRigidBody.AddForce(Vector3.up * forceMultiplier, ForceMode.Impulse); } }
void FixedUpdate() { if (myControlerManager.getAwake() && Input.anyKeyDown && !Input.GetKey(KeyCode.Space)) { thisRigidBody.AddForceAtPosition(transform.right * -forceMultiplier, hitPos, ForceMode.Impulse); fallen = true; } if (fallen && transform.position.y < 7.5f) { if (!look) { //vl.interuptCamera(this.gameObject, 10); look = true; } } }