Initialize() public method

public Initialize ( Seeker s, Path p, bool mergePartEndpoints, RichFunnel simplificationMode ) : void
s Seeker
p Path
mergePartEndpoints bool
simplificationMode RichFunnel
return void
Exemplo n.º 1
0
        void OnPathComplete(Path p)
        {
            waitingForPathCalc = false;
            p.Claim(this);

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

            if (traversingSpecialPath)
            {
                delayUpdatePath = true;
            }
            else
            {
                if (rp == null)
                {
                    rp = new RichPath();
                }
                rp.Initialize(seeker, p, true, funnelSimplification);
            }
            p.Release(this);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        void OnPathComplete(Path p)
        {
            waitingForPathCalc = false;
            p.Claim(this);

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

            if (traversingSpecialPath)
            {
                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 #TargetReached
                // property is up to date.
                var part = richPath.GetCurrentPart() as RichFunnel;
                if (part != null)
                {
                    var position = movementPlane.ToPlane(UpdateTarget(part));
                    if (lastCorner && nextCorners.Count == 1)
                    {
                        // Target point
                        Vector2 targetPoint = waypoint = movementPlane.ToPlane(nextCorners[0]);
                        distanceToWaypoint = (targetPoint - position).magnitude;
                        if (distanceToWaypoint <= endReachedDistance)
                        {
                            NextPart();
                        }
                    }
                }
            }
            p.Release(this);
        }