public List <List <GridPosition> > getPossibleMovement(GridPosition currentPos, int maxMovement, int maxJump) { PathingHelper pathingHelper = new PathingHelper(); pathingHelper.walkableAreas = walkableArea; pathingHelper.enemyUnitPositions = getEnemyUnitPositions(); pathingHelper.playerUnitPositions = getPlayerUnitPositions(); pathingHelper.blockingEffectPositions = getActionItemPositions(); List <List <GridPosition> > paths = pathingHelper.getPossiblePaths2(currentPos, maxMovement, maxJump, activeUnit.GetComponent <UnitController>().isPlayerUnit); /* * List<GridPosition> possibleMoves = new List<GridPosition>(); * foreach (WalkableArea wa in levelController.walkableArea) * { * //TODO account for elevation difference * if (IsometricHelper.distanceBetweenGridPositions(wa.position, currentPos) <= maxMovement && * (getObjectAtPosition(wa.position) == null || wa.position.Equals(currentPos))) * { * possibleMoves.Add(wa.position); * } * } */ return(paths); }
public void StartWave() { if (!IsWaveActive) { var path = PathingHelper.ShortestPath(CreatePosition.position, DestroyPosition.position, Vector2.negativeInfinity); foreach (var step in path) { _pathTiles.Add(Instantiate(PathTile, step, Quaternion.identity)); } Path = PathingHelper.CollapsePath(CreatePosition.position, path); if (_currWave >= 0) { _waves[_currWave % _waves.Length].OnCreateEnemy -= HandleCreateEnemy; _waves[_currWave % _waves.Length].OnWaveCleared -= HandleWaveCleared; } var wave = _waves[++_currWave % _waves.Length]; wave.OnCreateEnemy += HandleCreateEnemy; wave.OnWaveCleared += HandleWaveCleared; wave.StartWave(_currWave); WavePreview.UpdateWave(null, -1); } }
public bool HasPath(Vector2 exclude) { return(PathingHelper.ShortestPath(StartPosition.position, EndPosition.position, exclude).Count > 0); }