89,24): error CS1519: Invalid token ‘=’ in class, record, struct, or interface member declaration
(88,3): error CS1519: Invalid token ‘{’ in class, record, struct, or interface member declaration
(90,24): error CS1519: Invalid token ‘=’ in class, record, struct, or interface member declaration
error CS1519: Invalid token ‘=’ in class, record, struct, or interface member declaration
(92,24): error CS1519: Invalid token ‘=’ in class, record, struct, or interface member declaration
95,3): error CS8803: Top-level statements must precede namespace and type declarations.
95,3): error CS0106: The modifier ‘private’ is not valid for this item
(103,3): error CS0106: The modifier ‘private’ is not valid for this item
(113,3): error CS0106: The modifier ‘private’ is not valid for this item
(118,1): error CS1022: Type or namespace definition, or end-of-file expected
вот сам скрипт
> 1. using System.Collections;
> 2. using System.Collections.Generic;
> 3. using UnityEngine;
> 4. using TMPro;
>
> 5. public enum DrivetrainType
> 6. {
> 7. FWD, //front - wheel-drive
> 8. RWD, //rear-wheel-drive
> 9. }
> 10. public class CarMovementController : MonoBehaviour
> 11. {
> 12. [SerializeField] DrivetrainType drivetrainType;
> 13. private Rigidbody rb;
>
> 14. [SerializeField] WheelCollider wheelFL;
> 15. [SerializeField] WheelCollider wheelFR;
> 16. [SerializeField] WheelCollider wheelRL;
> 17. [SerializeField] WheelCollider wheelRR;
>
> 18. private float rbVelocityLimit = 15f;
> 19. private float accelartionStraight = 400f;
>
> 20. private float currentYRotation;
> 21. private float targetYRotation;
>
> 22. [SerializeField] private AnimationCurve Curve;
>
> 23. private void Awake()
> 24. {
> 25. rb = GetComponent<Rigidbody>();
>
> 26. wheelFL.transform.localEulerAngles = Vector3.zero;
> 27. wheelFR.transform.localEulerAngles = Vector3.zero;
> 28. }
> 29. private void FixedUpdate()
> 30. {
> 31. float horizontalForce = Input.GetAxis("Horizontal");
> 32. float verticalForce = Input.GetAxis("Verticval");
>
> 33. float currentVelocity = rb.velocity.magnitude;
> 34. targetYRotation = horizontalForce * curve.Evalute(currentVelocity);
>
> 35. RotateWheels(targetYRotation);
>
> 36. wheelFL.steerAngle = targetYRotation;
> 37. wheelFR.steerAngle = targetYRotation;
>
> 38. currentYRotation = targetYRotation;
>
> 39. if (verticalForce > 0)
> 40. {
> 41. ResetBrakes();
>
> 42. if (drivetrainType == DrivetrainType.FWD)
> 43. {
> 44. wheelFL.motorTorque = verticalForce * accelartionStraight * (2.8f - currentVelocity / rbVelocityLimit);
> 45. wheelFR.motorTorque = verticalForce * accelartionStraight * (2.8f - currentVelocity / rbVelocityLimit);
>
> 46. wheelRL.motorTorque = verticalForce * accelartionStraight * (2.2f - currentVelocity / rbVelocityLimit);
> 47. wheelRR.motorTorque = verticalForce * accelartionStraight * (2.2f - currentVelocity / rbVelocityLimit);
> 48. }
> 49. else if (drivetrainType == DrivetrainType.RWD)
> 50. {
> 51. wheelFL.motorTorque = verticalForce * accelartionStraight * (2.2f - currentVelocity / rbVelocityLimit);
> 52. wheelFR.motorTorque = verticalForce * accelartionStraight * (2.2f - currentVelocity / rbVelocityLimit);
>
> 53. wheelRL.motorTorque = verticalForce * accelartionStraight * (2.8f - currentVelocity / rbVelocityLimit);
> 54. wheelRR.motorTorque = verticalForce * accelartionStraight * (2.8f - currentVelocity / rbVelocityLimit);
> 55. }
> 56. }
> 57. float moveDirection = Vector3.Dot(transform.forward, rb.velocity);
> 58. if (moveDirection < -0.5f && verticalForce > 1)
> 59. {
> 60. PerformBrake(Mathf.Abs(verticalForce));
> 61. }
> 62. else if (moveDirection > 0.5f && verticalForce < 0)
> 63. {
> 64. PerformBrake(Mathf.Abs(verticalForce));
> 65. }
> 66. else if (verticalForce <0)
> 67. {
> 68. //PerformMoveBackwards
> 69. }
>
> 70. }
> 71. private void ResetBrakes();
> 72. {
> 73. wheelFL.brakeTorque = 0f;
> 74. wheelFR.brakeTorque = 0f;
> 75. wheelRL.brakeTorque = 0f;
> 76. wheelRR.brakeTorque = 0f;
> 77. }
>
> 78. private void PerformBrake(float force)
> 79. {
> 80. wheelFL.brakeTorque = force * 150f * 0.3f * accelartionStraight;
> 81. wheelFR.brakeTorque = force * 150f * 0.3f * accelartionStraight;
> 82. wheelRL.brakeTorque = force * 150f * 0.7f * accelartionStraight;
> 83. wheelRR.brakeTorque = force * 150f * 0.7f * accelartionStraight;
> 84. }
>
> 85. private void PerformMoveBackwards(float forse)
> 86. {
> 87. ResetBrakes();
>
> 88. wheelFL.motorTorque = force * accelartionStraight * 0.4f;
> 89. wheelFR.motorTorque = force * accelartionStraight * 0.4f;
> 90. wheelRL.motorTorque = force * accelartionStraight * 0.4f;
> 91. wheelRR.motorTorque = force * accelartionStraight * 0.4f;
> 92. }
> 93.
> 94. private void RotateWheels(float targetYAngle)
> 95. {
> 96. wheelFL.transform.localEulerAngles = new Vector3(wheelFL.transform.localEulerAngles.x, targetYAngle, wheelFL.transform.localEulerAngles.z);
> 97. wheelFR.transform.localEulerAngles = new Vector3(wheelFR.transform.localEulerAngles.x, targetYAngle, wheelFR.transform.localEulerAngles.z);
> 98. }
> 99. }