void OnResetCar() { if (vehicle != null) { VPResetVehicle resetScript = vehicle.GetComponent <VPResetVehicle>(); if (resetScript != null) { resetScript.DoReset(); this.gameObject.SetActive(false); } } }
public void Reset() { StopAllCoroutines(); _runningTime = 0f; _avgSpeed = 0; _goneDistance = 0f; globalPenalty = 0f; _currentCheckpoint = 0; _cachedFitness = 0f; _fitnessSinceLastCheck = 0f; _lastPosition = _initPosition; _vpResetVehicle.DoReset(); var curTransform = transform; curTransform.position = _initPosition; curTransform.eulerAngles = _initEulerAngles; curTransform.rotation = _initRotation; _rigidbody.isKinematic = true; // ReSharper disable once Unity.PerformanceCriticalCodeInvocation StartCoroutine(KillIfInefficient()); }