Beispiel #1
0
        public static bool TryGetPathLength(Node _from, Node _to, out float _length)           // very hax
        {
            FindPath _pathFinder = new FindPath(null);

            _pathFinder.startNodeGridPos  = _from.GridPos;
            _pathFinder.targetNodeGridPos = _to.GridPos;

            State _state;

            _pathFinder.Start(out _state);
            if (_state == State.Abort)
            {
                _length = 0;
                return(false);
            }

            while (_state == State.Tick)
            {
                _pathFinder.Tick(out _state);
            }

            _length = _pathFinder.pathLength;
            return(_state == State.Done);
        }