Пример #1
0
    private void WaypointReached()
    {
        currentWaypointIndex++;
        if (currentWaypointIndex == track.WayPoints.Count - 1)
        {
            OnReachedFinalWaypoint?.Invoke(this, null);
            this.enabled = false;
            return;
        }

        previousWayPoint = track.WayPoints[currentWaypointIndex];
        nextWayPoint     = track.WayPoints[currentWaypointIndex + 1];
        // Begin rotating towards the next waypoint
        targetRotation = Quaternion.LookRotation(new Vector3(nextWayPoint.position.x - playerCenter.position.x,
                                                             0, nextWayPoint.position.z - playerCenter.position.z));
        initialRotation = playerCenter.rotation;
    }
Пример #2
0
 private void ReachedFinalWaypoint()
 {
     step = -1;
     OnReachedFinalWaypoint?.Invoke();
 }