Exemple #1
0
 public NavGridPath(NavGrid navGrid, SteeringCharacter aiCharacter)
 {
     _navGrid           = navGrid;
     _cellGrid          = _navGrid.GetCellGrid();
     _path              = new List <NavGrid.Cell>();
     _totalPointsInPath = 0;
     _currentPathIndex  = 0;
     _unvisitedCellsFPQ = new FastPriorityQueue <NavGrid.Cell>(_navGrid.rows * _navGrid.cols);
     _aiCharacter       = aiCharacter;
 }
        override public void InitForFrame()
        {
            if (_navGridPath == null)
            {
                NavGrid navGrid = SteeringManager.Instance.GetNavGrid();
                if (navGrid != null)
                {
                    _navGridPath = new NavGridPath(navGrid, _steeringCharacter);
                }
            }
            else
            {
                if (target != null)
                {
                    targetPos = target.transform.position;
                }
                _nextTargetPos = _navGridPath.GetNextPos(targetPos, ref _isDestinationPos);
            }

            base.InitForFrame();
        }
Exemple #3
0
 public void RegisterNavGrid(NavGrid navGrid)
 {
     _navGrid = navGrid;
 }