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); }