示例#1
0
    public void SearchPath(VInt3 target)
    {
        if (this.path != null)
        {
            bool flag = true;
            long num  = this.targetSearchPos.XZSqrMagnitude(ref target);
            if (num < 1L)
            {
                if (this.targetReached)
                {
                    num = this.actor.get_handle().location.XZSqrMagnitude(ref this.targetPos);
                    if (num < 100L)
                    {
                        flag = false;
                    }
                }
                else
                {
                    flag = false;
                }
            }
            if (!flag)
            {
                return;
            }
        }
        int num2;

        this.targetPosIsValid = PathfindingUtility.ValidateTarget(this.GetFeetPosition(), target, out this.targetPos, out num2);
        VInt3 feetPosition = this.GetFeetPosition();
        int   actorCamp    = this.actor.get_handle().TheActorMeta.ActorCamp;

        this.seeker.RecyclePath();
        this.path = null;
        this.path = this.seeker.StartPathEx(ref feetPosition, ref this.targetPos, actorCamp, null, -1);
        if (this.path == null)
        {
            return;
        }
        this.targetSearchPos = target;
        this.canMove         = false;
        AstarPath.WaitForPath(this.path);
    }