using System.Collections;
public class playerScript : MonoBehaviour
public float thrust = 160;
public bool groundRest = false;
public float jumpThrust = 300;
public float counter = 0;
public bool object1Alive = true;
public bool object2Alive = true;
public bool object3Alive = true;
void Start() { rb = GetComponent(); }
pivotY = pivot.transform.eulerAngles.y;
if (Input.GetKey(KeyCode.W) && (pivotY >= 0 && pivotY <= 22.5f)) { rb.AddForce(new Vector3(0.1f, 0, 0.9f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 22.5f && pivotY <= 45)) { rb.AddForce(new Vector3(0.4f, 0, 0.6f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 45 && pivotY <= 67.5f)) { rb.AddForce(new Vector3(0.6f, 0, 0.4f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 67.5 && pivotY <= 90f)) { rb.AddForce(new Vector3(0.9f, 0, 0.1f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 90 && pivotY <= 112.5f)) { rb.AddForce(new Vector3(0.9f, 0, -0.1f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 112.5f && pivotY <= 135f)) { rb.AddForce(new Vector3(0.6f, 0, -0.4f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 135 && pivotY <= 157.5f)) { rb.AddForce(new Vector3(0.4f, 0, -0.6f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 157.5f && pivotY <= 180f)) { rb.AddForce(new Vector3(0.1f, 0, -0.9f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 180f && pivotY <= 202.5f)) { rb.AddForce(new Vector3(-0.1f, 0, -0.9f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 202.5f && pivotY <= 225f)) { rb.AddForce(new Vector3(-0.4f, 0, -0.6f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 225f && pivotY <= 247.5f)) { rb.AddForce(new Vector3(-0 - .6f, 0, -0.4f) * thrust);}
if (Input.GetKey(KeyCode.W) && (pivotY >= 247.5f && pivotY <= 270f)) { rb.AddForce(new Vector3(-0.9f, 0, -0.1f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 270f && pivotY <= 292.5f)) { rb.AddForce(new Vector3(-0.9f, 0, 0.1f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 292.5f && pivotY <= 315f)) { rb.AddForce(new Vector3(-0.6f, 0, 0.4f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 315f && pivotY <= 337.5f)) { rb.AddForce(new Vector3(-0.4f, 0, 0.6f) * thrust); }
if (Input.GetKey(KeyCode.W) && (pivotY >= 337.5f && pivotY <= 360f)) { rb.AddForce(new Vector3(-0.1f, 0, 0.9f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 0 && pivotY <= 22.5f)) { rb.AddForce(new Vector3(0.9f, 0, -0.1f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 22.5f && pivotY <= 45)) { rb.AddForce(new Vector3(0.6f, 0, -0.4f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 45 && pivotY <= 67.5f)) { rb.AddForce(new Vector3(0.4f, 0, -0.6f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 67.5 && pivotY <= 90f)) { rb.AddForce(new Vector3(0.1f, 0, -0.9f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 90 && pivotY <= 112.5f)) { rb.AddForce(new Vector3(-0.1f, 0, -0.9f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 112.5f && pivotY <= 135f)) { rb.AddForce(new Vector3(-0.4f, 0, -0.6f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 135 && pivotY <= 157.5f)) { rb.AddForce(new Vector3(-0 - .6f, 0, -0.4f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 157.5f && pivotY <= 180f)) { rb.AddForce(new Vector3(-0.9f, 0, -0.1f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 180f && pivotY <= 202.5f)) { rb.AddForce(new Vector3(-0.9f, 0, 0.1f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 202.5f && pivotY <= 225f)) { rb.AddForce(new Vector3(-0.6f, 0, 0.4f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 225f && pivotY <= 247.5f)) { rb.AddForce(new Vector3(-0.4f, 0, 0.6f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 247.5f && pivotY <= 270f)) { rb.AddForce(new Vector3(-0.1f, 0, 0.9f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 270f && pivotY <= 292.5f)) { rb.AddForce(new Vector3(0.1f, 0, 0.9f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 292.5f && pivotY <= 315f)) { rb.AddForce(new Vector3(0.4f, 0, 0.6f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 315f && pivotY <= 337.5f)) { rb.AddForce(new Vector3(0.6f, 0, 0.4f) * thrust); }
if (Input.GetKey(KeyCode.D) && (pivotY >= 337.5f && pivotY <= 360f)) { rb.AddForce(new Vector3(0.9f, 0, 0.1f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 0 && pivotY <= 22.5f)) { rb.AddForce(new Vector3(-0.1f, 0, -0.9f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 22.5f && pivotY <= 45)) { rb.AddForce(new Vector3(-0.4f, 0, -0.6f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 45 && pivotY <= 67.5f)) { rb.AddForce(new Vector3(-0 - .6f, 0, -0.4f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 67.5 && pivotY <= 90f)) { rb.AddForce(new Vector3(-0.9f, 0, -0.1f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 90 && pivotY <= 112.5f)) { rb.AddForce(new Vector3(-0.9f, 0, 0.1f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 112.5f && pivotY <= 135f)) { rb.AddForce(new Vector3(-0.6f, 0, 0.4f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 135 && pivotY <= 157.5f)) { rb.AddForce(new Vector3(-0.4f, 0, 0.6f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 157.5f && pivotY <= 180f)) { rb.AddForce(new Vector3(-0.1f, 0, 0.9f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 180f && pivotY <= 202.5f)) { rb.AddForce(new Vector3(0.1f, 0, 0.9f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 202.5f && pivotY <= 225f)) { rb.AddForce(new Vector3(0.4f, 0, 0.6f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 225f && pivotY <= 247.5f)) { rb.AddForce(new Vector3(0.6f, 0, 0.4f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 247.5f && pivotY <= 270f)) { rb.AddForce(new Vector3(0.9f, 0, 0.1f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 270f && pivotY <= 292.5f)) { rb.AddForce(new Vector3(0.9f, 0, -0.1f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 292.5f && pivotY <= 315f)) { rb.AddForce(new Vector3(0.6f, 0, -0.4f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 315f && pivotY <= 337.5f)) { rb.AddForce(new Vector3(0.4f, 0, -0.6f) * thrust); }
if (Input.GetKey(KeyCode.S) && (pivotY >= 337.5f && pivotY <= 360f)) { rb.AddForce(new Vector3(0.1f, 0, -0.9f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 0 && pivotY <= 22.5f)) { rb.AddForce(new Vector3(-0.9f, 0, 0.1f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 22.5f && pivotY <= 45)) { rb.AddForce(new Vector3(-0.6f, 0, 0.4f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 45 && pivotY <= 67.5f)) { rb.AddForce(new Vector3(-0.4f, 0, 0.6f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 67.5 && pivotY <= 90f)) { rb.AddForce(new Vector3(-0.1f, 0, 0.9f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 90 && pivotY <= 112.5f)) { rb.AddForce(new Vector3(0.1f, 0, 0.9f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 112.5f && pivotY <= 135f)) { rb.AddForce(new Vector3(0.4f, 0, 0.6f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 135 && pivotY <= 157.5f)) { rb.AddForce(new Vector3(0.6f, 0, 0.4f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 157.5f && pivotY <= 180f)) { rb.AddForce(new Vector3(0.9f, 0, 0.1f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 180f && pivotY <= 202.5f)) { rb.AddForce(new Vector3(0.9f, 0, -0.1f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 202.5f && pivotY <= 225f)) { rb.AddForce(new Vector3(0.6f, 0, -0.4f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 225f && pivotY <= 247.5f)) { rb.AddForce(new Vector3(0.4f, 0, -0.6f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 247.5f && pivotY <= 270f)) { rb.AddForce(new Vector3(0.1f, 0, -0.9f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 270f && pivotY <= 292.5f)) { rb.AddForce(new Vector3(-0.1f, 0, -0.9f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 292.5f && pivotY <= 315f)) { rb.AddForce(new Vector3(-0.4f, 0, -0.6f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 315f && pivotY <= 337.5f)) { rb.AddForce(new Vector3(-0 - .6f, 0, -0.4f) * thrust); }
if (Input.GetKey(KeyCode.A) && (pivotY >= 337.5f && pivotY <= 360f)) { rb.AddForce(new Vector3(-0.9f, 0, -0.1f) * thrust); }
if (Input.GetKey(KeyCode.Space) && groundRest == true)
rb.AddForce(new Vector3(0, 1, -0) * jumpThrust);
void OnCollisionEnter(Collision collision)
if (collision.gameObject.name == "ground") {groundRest = true;}
if (collision.gameObject.name == "trigger1") { object1Alive = false; counter = counter + 1; }
if (collision.gameObject.name == "trigger2") { object2Alive = false; counter = counter + 1; }
if (collision.gameObject.name == "trigger3") { object3Alive = false; counter = counter + 1; }