Пример #1
0
    public virtual void OnPathComplete(Path _p)
    {
        ABPath abpath = _p as ABPath;

        if (abpath == null)
        {
            throw new Exception("This function only handles ABPaths, do not use special path types");
        }
        this.canSearchAgain = true;
        abpath.Claim(this);
        if (abpath.error)
        {
            abpath.Release(this, false);
            return;
        }
        if (this.path != null)
        {
            this.path.Release(this, false);
        }
        this.path = abpath;
        if (this.path.vectorPath.Count == 1)
        {
            this.path.vectorPath.Add(this.path.vectorPath[0]);
        }
        this.interpolator.SetPath(this.path.vectorPath);
        ITransformedGraph transformedGraph = AstarData.GetGraph(this.path.path[0]) as ITransformedGraph;

        this.movementPlane = ((transformedGraph == null) ? GraphTransform.identityTransform : transformedGraph.transform);
        this.TargetReached = false;
        this.interpolator.MoveToLocallyClosestPoint((this.GetFeetPosition() + abpath.originalStartPoint) * 0.5f, true, true);
        this.interpolator.MoveToLocallyClosestPoint(this.GetFeetPosition(), true, true);
    }
Пример #2
0
        // Token: 0x06002139 RID: 8505 RVA: 0x0018D998 File Offset: 0x0018BB98
        protected override void OnPathComplete(Path newPath)
        {
            ABPath abpath = newPath as ABPath;

            if (abpath == null)
            {
                throw new Exception("This function only handles ABPaths, do not use special path types");
            }
            this.waitingForPathCalculation = false;
            abpath.Claim(this);
            if (abpath.error)
            {
                abpath.Release(this, false);
                return;
            }
            if (this.path != null)
            {
                this.path.Release(this, false);
            }
            this.path = abpath;
            if (this.path.vectorPath.Count == 1)
            {
                this.path.vectorPath.Add(this.path.vectorPath[0]);
            }
            this.interpolator.SetPath(this.path.vectorPath);
            ITransformedGraph transformedGraph = AstarData.GetGraph(this.path.path[0]) as ITransformedGraph;

            this.movementPlane    = ((transformedGraph != null) ? transformedGraph.transform : (this.rotationIn2D ? new GraphTransform(Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(-90f, 270f, 90f), Vector3.one)) : GraphTransform.identityTransform));
            this.reachedEndOfPath = false;
            this.interpolator.MoveToLocallyClosestPoint((this.GetFeetPosition() + abpath.originalStartPoint) * 0.5f, true, true);
            this.interpolator.MoveToLocallyClosestPoint(this.GetFeetPosition(), true, true);
            this.interpolator.MoveToCircleIntersection2D(base.position, this.pickNextWaypointDist, this.movementPlane);
            if (this.remainingDistance <= this.endReachedDistance)
            {
                this.reachedEndOfPath = true;
                this.OnTargetReached();
            }
        }