Ejemplo n.º 1
0
        private void DrawPathToSelectedMarker(IEnumerable <PathfindingMarker> selectedMarkers)
        {
            PathfindingMarker otherSelectedMarker = selectedMarkers.First(marker => marker != this);

            const int defaultIndex = 0;

            if (_currentlySelectedMarkers == null ||
                (_currentlySelectedMarkers != null &&
                 _currentlySelectedMarkers[defaultIndex]
                 != otherSelectedMarker))
            {
                _currentlySelectedMarkers = new List <PathfindingMarker>()
                {
                    otherSelectedMarker
                };
                Logging.Log("Selected new markers");
                RequestPathTo(otherSelectedMarker, grid.defaultJumpHeight);
            }

            if (_pathToCurrentlySelectedMarkers == null)
            {
                Logging.Log("Path not created yet");
                return;
            }

            PathfindingMarker currentSelectedMarker = _currentlySelectedMarkers[defaultIndex];

            // Logging.Log("Drawing path between markers");
            AffectDrawOfMarkers(_pathToCurrentlySelectedMarkers);

            currentSelectedMarker._drawColor = Color.black;
            _drawColor = Color.black;
        }
Ejemplo n.º 2
0
        private void RequestPathTo(PathfindingMarker marker, float maxJumpHeight)
        {
            Logging.Log($"Finding path to {marker.name} from {name}");

            _pathToCurrentlySelectedMarkers = null;

            grid.GetPath(this, marker, this, maxJumpHeight);

            _workInProgressPath = new List <PathfindingMarker> [1];
            CurrentPathfinders  = new IPathfinder[1];
        }
Ejemplo n.º 3
0
        private void DrawRayGizmosToConnectedMarkers()
        {
            // if (adjacentMarkers == null || adjacentMarkers.Count == 0) return;

            foreach (MarkerStats markerStat in connectedMarkers.Where(markerStat => markerStat != null))
            {
                PathfindingMarker marker = markerStat.marker;

                Vector3 markerPos = marker.transform.position;
                Vector3 position  = transform.position;

                Vector3 vectorToChild = markerPos - position;
                Gizmos.DrawRay(position, vectorToChild);
            }
        }
Ejemplo n.º 4
0
 public void GetMultiPath(IPathRequester pathRequester, PathfindingMarker startMarker, List <PathfindingMarker> pathMarkers, float maxJumpHeight)
 {
     CheckPathfindingManager();
     pathfindingManager.RequestMultiPath(pathRequester, startMarker, pathMarkers, maxJumpHeight);
 }
Ejemplo n.º 5
0
 public void GetPath(IPathRequester pathRequester, PathfindingMarker marker1, PathfindingMarker marker2, float maxJumpHeight)
 {
     CheckPathfindingManager();
     pathfindingManager.RequestPath(pathRequester, marker1, marker2, maxJumpHeight);
 }
Ejemplo n.º 6
0
 public MarkerStats(PathfindingMarker marker, float yDist, AdjacencyDirection direction)
 {
     this.marker       = marker;
     yDistance         = yDist;
     relativeDirection = direction;
 }