Pathfinding.RichPath.GetCurrentPart C# (CSharp) Method

GetCurrentPart() public method

public GetCurrentPart ( ) : RichPathPart
return RichPathPart
		public RichPathPart GetCurrentPart () {
			if (currentPart >= parts.Count) return null;
			return parts[currentPart];
		}
		

Usage Example

Example #1
0
        protected override void OnPathComplete(Path p)
        {
            waitingForPathCalculation = false;
            p.Claim(this);

            if (p.error)
            {
                p.Release(this);
                return;
            }

            if (traversingOffMeshLink)
            {
                delayUpdatePath = true;
            }
            else
            {
                richPath.Initialize(seeker, p, true, funnelSimplification);

                // Check if we have already reached the end of the path
                // We need to do this here to make sure that the #reachedEndOfPath
                // property is up to date.
                var part = richPath.GetCurrentPart() as RichFunnel;
                if (part != null)
                {
                    if (updatePosition)
                    {
                        simulatedPosition = tr.position;
                    }

                    // Note: UpdateTarget has some side effects like setting the nextCorners list and the lastCorner field
                    var localPosition = movementPlane.ToPlane(UpdateTarget(part));

                    // Target point
                    steeringTarget = nextCorners[0];
                    Vector2 targetPoint = movementPlane.ToPlane(steeringTarget);
                    distanceToSteeringTarget = (targetPoint - localPosition).magnitude;

                    if (lastCorner && nextCorners.Count == 1 && distanceToSteeringTarget <= endReachedDistance)
                    {
                        NextPart();
                    }
                }
            }
            p.Release(this);
        }
All Usage Examples Of Pathfinding.RichPath::GetCurrentPart