private void Awake() { Gear = 0; Velocity = MinVelocity; RPM = 0.0f; HandleAngle = 0.2f; bIsAccelerating = false; bIsRotating = false; bIsBreaking = false; Acceleration = 0.001f; accelDirection = AccelDirection.Forward; rotationDirection = RotationDirection.None; }
void ResetInputActionParams() { Gear = 0; Velocity = MinVelocity; RPM = 0.0f; HandleAngle = 0.2f; bIsAccelerating = false; bIsRotating = false; bIsBreaking = false; Acceleration = 0.001f; accelDirection = AccelDirection.Forward; rotationDirection = RotationDirection.None; }
// Update is called once per frame void Update() { //Debug.Log(transform.position); //Debug.Log("Actor Forward Vector : " + transform.forward); //Debug.Log("Actor Right Vector : " + transform.right); //Debug.Log("Actor Up Vector : " + transform.up); if (Input.GetKeyDown(KeyCode.W)) { bIsAccelerating = true; // Debug.Log("ff"); } if (Input.GetKeyUp(KeyCode.W)) { bIsAccelerating = false; // Velocity = MinVelocity; } if (Input.GetKeyDown(KeyCode.S)) { bIsAccelerating = true; accelDirection = AccelDirection.Backward; } if (Input.GetKeyUp(KeyCode.S)) { bIsAccelerating = false; accelDirection = AccelDirection.Forward; } if (Input.GetKeyDown(KeyCode.A)) { rotationDirection = RotationDirection.Left; } if (Input.GetKeyUp(KeyCode.A)) { rotationDirection = RotationDirection.None; } if (Input.GetKeyDown(KeyCode.D)) { rotationDirection = RotationDirection.Right; } if (Input.GetKeyUp(KeyCode.D)) { rotationDirection = RotationDirection.None; } if (Input.GetKeyDown(KeyCode.R)) { //gameObject.transform.position = StartingPoint; //ResetInputActionParams(); //gameObject.transform.rotation = StartingRotation; // SceneManager.LoadScene("SampleScene"); // UnityEngine.SceneManagement. SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } Accereate(); Deceleration(); RotateCar(); }