Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void sTrack()
- {
- if (path == null || GlobalLastSighting != lastplayersight.playerPosition)
- {
- GlobalLastSighting = lastplayersight.playerPosition;
- seeker.StartPath(transform.position, lastplayersight.playerPosition, OnPathComplete);
- //We have no path to move after yet
- Debug.Log("-----NO PATH---");
- return;
- }
- if (Vector3.Distance(transform.position, path.vectorPath[currentWaypoint]) < nextWaypointDistance)
- {
- currentWaypoint++;
- }
- if (currentWaypoint >= path.vectorPath.Count)
- {
- waitTrackTimer += Time.deltaTime;
- if (waitTrackTimer >= waitAfterTrack) {
- Debug.Log("End Of Path Reached");
- if (!seePlayer) lastplayersight.playerPosition = lastplayersight.playerPositionDefault;
- if (!seePlayer) personalLastSighting = lastplayersight.playerPositionDefault;
- GlobalLastSighting = lastplayersight.playerPosition;
- currentWaypoint = 0;
- path = null;
- return;
- }
- }
- if (currentWaypoint < path.vectorPath.Count)
- rb.AddForce((path.vectorPath[currentWaypoint] - transform.position) * TrackSpeed);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement