Created
July 12, 2011 03:10
-
-
Save Gillissie/1077319 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<<<<<<< HEAD | |
duration = JUMP_TIME; | |
halfDuration = duration * 0.5f; | |
startTime = Time.time; | |
======= | |
while (closest == null && nextList.Count > 0) | |
{ | |
tileList = nextList; | |
nextList = new List<Tile>(); | |
foreach (Tile tile in tileList) | |
{ | |
// see if we can use this tile as a drop location, then rank it | |
if ((tile.item == null || tile.isPassable) && (tile.y > -1f) && tile.isFlat) | |
{ | |
float distance = (tile.vector3 - cameraPosition).sqrMagnitude; | |
if (distance < closestDistance) | |
{ | |
closestDistance = distance; | |
closest = tile; | |
} | |
} | |
// add any unvisited neighbors to the next list | |
foreach (Tile neighbor in tile.allAdjacentTiles()) | |
{ | |
if (!visited.Contains(neighbor)) | |
{ | |
visited.Add(neighbor); | |
nextList.Add(neighbor); | |
} | |
} | |
} | |
>>>>>>> Tile-level pathfinding. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment