protected void RandomTileTarget() { _from.Set(X, Y); while (true) { _Tile[,] tempTiles = _LevelController.instance.tiles; _Tile targetTile = tempTiles[UnityEngine.Random.Range(0, tempTiles.GetLength(0)), UnityEngine.Random.Range(0, tempTiles.GetLength(1))]; if (targetTile is Floor) { _to.Set(targetTile.X, targetTile.Y); path = PathFind.Pathfinding.FindPath(grid, _from, _to); if (path.Count != 0) { ExtrapolatePath(path); break; } } } }
void SetTarget(Vector2Int newTarget) { lastTarget = new Vector2Int(targetPoint.x, targetPoint.y); targetPoint.Set(newTarget.x, newTarget.y); }