├── Demo Project ├── Assets │ ├── Demo scene.unity │ ├── Demo scene.unity.meta │ ├── Materials.meta │ ├── Materials │ │ ├── Ground.mat │ │ ├── Ground.mat.meta │ │ ├── Obstacle.mat │ │ ├── Obstacle.mat.meta │ │ ├── Target.mat │ │ ├── Target.mat.meta │ │ ├── Unit.mat │ │ └── Unit.mat.meta │ ├── Scripts.meta │ └── Scripts │ │ ├── Grid.cs │ │ ├── Grid.cs.meta │ │ ├── Heap.cs │ │ ├── Heap.cs.meta │ │ ├── Node.cs │ │ ├── Node.cs.meta │ │ ├── Pathfinding.cs │ │ ├── Pathfinding.cs.meta │ │ ├── Unit.cs │ │ └── Unit.cs.meta ├── Library │ ├── AnnotationManager │ ├── AssetImportState │ ├── AssetServerCacheV3 │ ├── BuildPlayer.prefs │ ├── BuildSettings.asset │ ├── CrashedAssetImports.txt │ ├── CurrentLayout.dwlt │ ├── EditorUserBuildSettings.asset │ ├── EditorUserSettings.asset │ ├── InspectorExpandedItems.asset │ ├── LibraryFormatVersion.txt │ ├── MonoManager.asset │ ├── ScriptAssemblies │ │ ├── Assembly-CSharp.dll │ │ ├── Assembly-CSharp.dll.mdb │ │ └── BuiltinAssemblies.stamp │ ├── ScriptMapper │ ├── ShaderCache │ │ ├── 0 │ │ │ └── 0f909d099790e3ce34ffec13b4698074.bin │ │ ├── 1 │ │ │ ├── 151af99bf62e6e277c3c7cb483b63ff6.bin │ │ │ └── 169801d8788f8d44aa88d0308c79c1c1.bin │ │ ├── 2 │ │ │ ├── 246d5c253b2d0aa98e7d1974acb4198f.bin │ │ │ └── 2b2ddf76f104ca2fd52eda6c4528dcd7.bin │ │ ├── 3 │ │ │ └── 331531103963323037c7d99fb5e6c74d.bin │ │ ├── 4 │ │ │ └── 47c8f232f517a175e42b10a2f8bc6ee8.bin │ │ ├── 5 │ │ │ ├── 52bd9272b92fde934a01bf72bf9e55cd.bin │ │ │ └── 5ebf76b0705f1af7261b08ec9fed077a.bin │ │ ├── 7 │ │ │ └── 777d79fc3030c1569ce350b2b4503afe.bin │ │ ├── 9 │ │ │ └── 9bb6911e0f1215e08b2f899a51fa088d.bin │ │ ├── a │ │ │ ├── aa5be66ada3ec8a619d24e7e373031f9.bin │ │ │ └── aa7a12d021084202b1b3f9ddc0cdaa60.bin │ │ ├── b │ │ │ ├── b2caf624bbe7e371f825bc753ac5d2f1.bin │ │ │ └── bc987d185fa829f7760e6e0a93449b11.bin │ │ ├── c │ │ │ ├── c0bf546b492c3d93ea9a9a8a981a72f4.bin │ │ │ └── cc1d1ee6a7754b7d814441e148ab4bc7.bin │ │ ├── d │ │ │ ├── d3485449d000502e6767ff6cd01fcebf.bin │ │ │ └── daa0e783859a812e93dfa8e0013c3719.bin │ │ ├── e │ │ │ ├── e3c75c215c69cda59bf5642a7f33c79d.bin │ │ │ ├── e45d5b50a5a73a1e1301aec3376c1568.bin │ │ │ └── e95eb3ceab8e4c3c3400917398b6b7c5.bin │ │ └── f │ │ │ ├── f890672bf3ff5b60accf2dccec289da9.bin │ │ │ └── ffb0130abef283e98ba076625680d37d.bin │ ├── assetDatabase3 │ ├── metadata │ │ ├── 12 │ │ │ ├── 1202d32d359e843d3ba73838b494c11f │ │ │ └── 1202d32d359e843d3ba73838b494c11f.info │ │ ├── 42 │ │ │ ├── 424cb0975868e49da970af86793d23b6 │ │ │ └── 424cb0975868e49da970af86793d23b6.info │ │ ├── 49 │ │ │ ├── 4922e6cb6710847e596b241ed7bb5122 │ │ │ └── 4922e6cb6710847e596b241ed7bb5122.info │ │ ├── 73 │ │ │ ├── 739bbd9f364b4268874f9fd86ab3beef │ │ │ └── 739bbd9f364b4268874f9fd86ab3beef.info │ │ ├── 80 │ │ │ ├── 80a3616ca19596e4da0f10f14d241e9f │ │ │ └── 80a3616ca19596e4da0f10f14d241e9f.info │ │ ├── 85 │ │ │ ├── 852e56802eb941638acbb491814497b0 │ │ │ ├── 852e56802eb941638acbb491814497b0.info │ │ │ ├── 85dfd2f67d7434b78b5f716b77f72d32 │ │ │ └── 85dfd2f67d7434b78b5f716b77f72d32.info │ │ ├── 86 │ │ │ ├── 86a1e01bfe79445f0985df1b1caa41fb │ │ │ └── 86a1e01bfe79445f0985df1b1caa41fb.info │ │ ├── 87 │ │ │ ├── 870353891bb340e2b2a9c8707e7419ba │ │ │ └── 870353891bb340e2b2a9c8707e7419ba.info │ │ ├── 97 │ │ │ ├── 97decbdab0634cdd991f8d23ddf0dead │ │ │ └── 97decbdab0634cdd991f8d23ddf0dead.info │ │ ├── 00 │ │ │ ├── 00000000000000001000000000000000 │ │ │ ├── 00000000000000001000000000000000.info │ │ │ ├── 00000000000000002000000000000000 │ │ │ ├── 00000000000000002000000000000000.info │ │ │ ├── 00000000000000003000000000000000 │ │ │ ├── 00000000000000003000000000000000.info │ │ │ ├── 00000000000000004000000000000000 │ │ │ ├── 00000000000000004000000000000000.info │ │ │ ├── 00000000000000004100000000000000 │ │ │ ├── 00000000000000004100000000000000.info │ │ │ ├── 00000000000000005000000000000000 │ │ │ ├── 00000000000000005000000000000000.info │ │ │ ├── 00000000000000005100000000000000 │ │ │ ├── 00000000000000005100000000000000.info │ │ │ ├── 00000000000000006000000000000000 │ │ │ ├── 00000000000000006000000000000000.info │ │ │ ├── 00000000000000006100000000000000 │ │ │ ├── 00000000000000006100000000000000.info │ │ │ ├── 00000000000000007000000000000000 │ │ │ ├── 00000000000000007000000000000000.info │ │ │ ├── 00000000000000007100000000000000 │ │ │ ├── 00000000000000007100000000000000.info │ │ │ ├── 00000000000000008000000000000000 │ │ │ ├── 00000000000000008000000000000000.info │ │ │ ├── 00000000000000008100000000000000 │ │ │ ├── 00000000000000008100000000000000.info │ │ │ ├── 00000000000000009000000000000000 │ │ │ ├── 00000000000000009000000000000000.info │ │ │ ├── 0000000000000000a000000000000000 │ │ │ ├── 0000000000000000a000000000000000.info │ │ │ ├── 0000000000000000a100000000000000 │ │ │ ├── 0000000000000000a100000000000000.info │ │ │ ├── 0000000000000000b000000000000000 │ │ │ ├── 0000000000000000b000000000000000.info │ │ │ ├── 0000000000000000c000000000000000 │ │ │ └── 0000000000000000c000000000000000.info │ │ ├── 0b │ │ │ ├── 0b726f59db629488285572e4968789b2 │ │ │ └── 0b726f59db629488285572e4968789b2.info │ │ ├── 1a │ │ │ ├── 1a3a0e3f16d3945268a3d9141742bd04 │ │ │ └── 1a3a0e3f16d3945268a3d9141742bd04.info │ │ ├── 2f │ │ │ ├── 2fe6938f04445463bb8f1d008e3cc672 │ │ │ └── 2fe6938f04445463bb8f1d008e3cc672.info │ │ ├── 3c │ │ │ ├── 3c0ad459c1534645b5d603b7cc258f97 │ │ │ └── 3c0ad459c1534645b5d603b7cc258f97.info │ │ ├── 5f │ │ │ ├── 5f32cd94baa94578a686d4b9d6b660f7 │ │ │ └── 5f32cd94baa94578a686d4b9d6b660f7.info │ │ ├── 6a │ │ │ ├── 6a21e3f33d51842d29a1fc3396dbd468 │ │ │ └── 6a21e3f33d51842d29a1fc3396dbd468.info │ │ ├── 7c │ │ │ ├── 7cbab2be89b54486bbd23a6fe637d30e │ │ │ └── 7cbab2be89b54486bbd23a6fe637d30e.info │ │ ├── 8e │ │ │ ├── 8e0cd8ed44d4412cbe0642067abc9e44 │ │ │ └── 8e0cd8ed44d4412cbe0642067abc9e44.info │ │ ├── ad │ │ │ ├── adebbd281f1a4ef3a30be7f21937e02f │ │ │ └── adebbd281f1a4ef3a30be7f21937e02f.info │ │ ├── b5 │ │ │ ├── b544c8c8b79e04b06983aab1c75bd87c │ │ │ └── b544c8c8b79e04b06983aab1c75bd87c.info │ │ ├── c9 │ │ │ ├── c905570c753f941cdb9928ddf601b830 │ │ │ └── c905570c753f941cdb9928ddf601b830.info │ │ ├── de │ │ │ ├── dedc3f0be85254c40a8e2cda2410210d │ │ │ └── dedc3f0be85254c40a8e2cda2410210d.info │ │ └── f5 │ │ │ ├── f5f67c52d1564df4a8936ccd202a3bd8 │ │ │ └── f5f67c52d1564df4a8936ccd202a3bd8.info │ └── shadercompiler-UnityShaderCompiler0.log └── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── Physics2DSettings.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ ├── UnityAdsSettings.asset │ └── UnityConnectSettings.asset ├── LICENSE └── Scripts ├── Grid.cs ├── Heap.cs ├── Node.cs ├── Pathfinding.cs └── Unit.cs /Demo Project/Assets/Demo scene.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Assets/Demo scene.unity -------------------------------------------------------------------------------- /Demo Project/Assets/Demo scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b726f59db629488285572e4968789b2 3 | timeCreated: 1481210241 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Demo Project/Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b544c8c8b79e04b06983aab1c75bd87c 3 | folderAsset: yes 4 | timeCreated: 1481209777 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Demo Project/Assets/Materials/Ground.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Assets/Materials/Ground.mat -------------------------------------------------------------------------------- /Demo Project/Assets/Materials/Ground.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c905570c753f941cdb9928ddf601b830 3 | timeCreated: 1481209782 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Demo Project/Assets/Materials/Obstacle.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Assets/Materials/Obstacle.mat -------------------------------------------------------------------------------- /Demo Project/Assets/Materials/Obstacle.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86a1e01bfe79445f0985df1b1caa41fb 3 | timeCreated: 1481209782 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Demo Project/Assets/Materials/Target.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Assets/Materials/Target.mat -------------------------------------------------------------------------------- /Demo Project/Assets/Materials/Target.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fe6938f04445463bb8f1d008e3cc672 3 | timeCreated: 1481209782 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Demo Project/Assets/Materials/Unit.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Assets/Materials/Unit.mat -------------------------------------------------------------------------------- /Demo Project/Assets/Materials/Unit.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1202d32d359e843d3ba73838b494c11f 3 | timeCreated: 1481209782 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Demo Project/Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 424cb0975868e49da970af86793d23b6 3 | folderAsset: yes 4 | timeCreated: 1481209628 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Demo Project/Assets/Scripts/Grid.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | public class Grid : MonoBehaviour { 6 | 7 | public bool displayGridGizmos; 8 | 9 | public LayerMask unwalkableMask; 10 | public Vector2 gridWorldSize; 11 | public float nodeRadius; 12 | 13 | Node[,] grid; 14 | float nodeDiameter; 15 | int gridSizeX, gridSizeY; 16 | 17 | void Awake() { 18 | nodeDiameter = nodeRadius*2; 19 | gridSizeX = Mathf.RoundToInt(gridWorldSize.x/nodeDiameter); 20 | gridSizeY = Mathf.RoundToInt(gridWorldSize.y/nodeDiameter); 21 | 22 | CreateGrid(); 23 | } 24 | 25 | public int MaxSize { 26 | get { 27 | return gridSizeX * gridSizeY; 28 | } 29 | } 30 | 31 | void CreateGrid() { 32 | grid = new Node[gridSizeX,gridSizeY]; 33 | Vector2 worldBottomLeft = (Vector2)transform.position - Vector2.right * gridWorldSize.x/2 - Vector2.up * gridWorldSize.y/2; 34 | 35 | for (int x = 0; x < gridSizeX; x ++) { 36 | for (int y = 0; y < gridSizeY; y ++) { 37 | Vector2 worldPoint = worldBottomLeft + Vector2.right * (x * nodeDiameter + nodeRadius) + Vector2.up * (y * nodeDiameter + nodeRadius); 38 | bool walkable = (Physics2D.OverlapCircle(worldPoint,nodeRadius,unwalkableMask) == null); // if no collider2D is returned by overlap circle, then this node is walkable 39 | 40 | grid[x,y] = new Node(walkable,worldPoint, x,y); 41 | } 42 | } 43 | } 44 | 45 | 46 | public List GetNeighbours(Node node, int depth = 1) { 47 | List neighbours = new List(); 48 | 49 | for (int x = -depth; x <= depth; x++) { 50 | for (int y = -depth; y <= depth; y++) { 51 | if (x == 0 && y == 0) 52 | continue; 53 | 54 | int checkX = node.gridX + x; 55 | int checkY = node.gridY + y; 56 | 57 | if (checkX >= 0 && checkX < gridSizeX && checkY >= 0 && checkY < gridSizeY) { 58 | neighbours.Add(grid[checkX,checkY]); 59 | } 60 | } 61 | } 62 | 63 | return neighbours; 64 | } 65 | 66 | 67 | public Node NodeFromWorldPoint(Vector2 worldPosition) { 68 | float percentX = (worldPosition.x + gridWorldSize.x/2) / gridWorldSize.x; 69 | float percentY = (worldPosition.y + gridWorldSize.y/2) / gridWorldSize.y; 70 | percentX = Mathf.Clamp01(percentX); 71 | percentY = Mathf.Clamp01(percentY); 72 | 73 | int x = Mathf.RoundToInt((gridSizeX-1) * percentX); 74 | int y = Mathf.RoundToInt((gridSizeY-1) * percentY); 75 | return grid[x,y]; 76 | } 77 | 78 | public Node ClosestWalkableNode(Node node) { 79 | int maxRadius = Mathf.Max (gridSizeX, gridSizeY) / 2; 80 | for (int i = 1; i < maxRadius; i++) { 81 | Node n = FindWalkableInRadius (node.gridX, node.gridY, i); 82 | if (n != null) { 83 | return n; 84 | 85 | } 86 | } 87 | return null; 88 | } 89 | Node FindWalkableInRadius(int centreX, int centreY, int radius) { 90 | 91 | for (int i = -radius; i <= radius; i ++) { 92 | int verticalSearchX = i + centreX; 93 | int horizontalSearchY = i + centreY; 94 | 95 | // top 96 | if (InBounds(verticalSearchX, centreY + radius)) { 97 | if (grid[verticalSearchX, centreY + radius].walkable) { 98 | return grid [verticalSearchX, centreY + radius]; 99 | } 100 | } 101 | 102 | // bottom 103 | if (InBounds(verticalSearchX, centreY - radius)) { 104 | if (grid[verticalSearchX, centreY - radius].walkable) { 105 | return grid [verticalSearchX, centreY - radius]; 106 | } 107 | } 108 | // right 109 | if (InBounds(centreY + radius, horizontalSearchY)) { 110 | if (grid[centreX + radius, horizontalSearchY].walkable) { 111 | return grid [centreX + radius, horizontalSearchY]; 112 | } 113 | } 114 | 115 | // left 116 | if (InBounds(centreY - radius, horizontalSearchY)) { 117 | if (grid[centreX - radius, horizontalSearchY].walkable) { 118 | return grid [centreX - radius, horizontalSearchY]; 119 | } 120 | } 121 | 122 | } 123 | 124 | return null; 125 | 126 | } 127 | 128 | bool InBounds(int x, int y) { 129 | return x>=0 && x= 0 && y where T : IHeapItem { 6 | 7 | T[] items; 8 | int currentItemCount; 9 | 10 | public Heap(int maxHeapSize) { 11 | items = new T[maxHeapSize]; 12 | } 13 | 14 | public void Add(T item) { 15 | item.HeapIndex = currentItemCount; 16 | items[currentItemCount] = item; 17 | SortUp(item); 18 | currentItemCount++; 19 | } 20 | 21 | public T RemoveFirst() { 22 | T firstItem = items[0]; 23 | currentItemCount--; 24 | items[0] = items[currentItemCount]; 25 | items[0].HeapIndex = 0; 26 | SortDown(items[0]); 27 | return firstItem; 28 | } 29 | 30 | public void UpdateItem(T item) { 31 | SortUp(item); 32 | } 33 | 34 | public int Count { 35 | get { 36 | return currentItemCount; 37 | } 38 | } 39 | 40 | public bool Contains(T item) { 41 | return Equals(items[item.HeapIndex], item); 42 | } 43 | 44 | void SortDown(T item) { 45 | while (true) { 46 | int childIndexLeft = item.HeapIndex * 2 + 1; 47 | int childIndexRight = item.HeapIndex * 2 + 2; 48 | int swapIndex = 0; 49 | 50 | if (childIndexLeft < currentItemCount) { 51 | swapIndex = childIndexLeft; 52 | 53 | if (childIndexRight < currentItemCount) { 54 | if (items[childIndexLeft].CompareTo(items[childIndexRight]) < 0) { 55 | swapIndex = childIndexRight; 56 | } 57 | } 58 | 59 | if (item.CompareTo(items[swapIndex]) < 0) { 60 | Swap (item,items[swapIndex]); 61 | } 62 | else { 63 | return; 64 | } 65 | 66 | } 67 | else { 68 | return; 69 | } 70 | 71 | } 72 | } 73 | 74 | void SortUp(T item) { 75 | int parentIndex = (item.HeapIndex-1)/2; 76 | 77 | while (true) { 78 | T parentItem = items[parentIndex]; 79 | if (item.CompareTo(parentItem) > 0) { 80 | Swap (item,parentItem); 81 | } 82 | else { 83 | break; 84 | } 85 | 86 | parentIndex = (item.HeapIndex-1)/2; 87 | } 88 | } 89 | 90 | void Swap(T itemA, T itemB) { 91 | items[itemA.HeapIndex] = itemB; 92 | items[itemB.HeapIndex] = itemA; 93 | int itemAIndex = itemA.HeapIndex; 94 | itemA.HeapIndex = itemB.HeapIndex; 95 | itemB.HeapIndex = itemAIndex; 96 | } 97 | 98 | 99 | 100 | } 101 | 102 | public interface IHeapItem : IComparable { 103 | int HeapIndex { 104 | get; 105 | set; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Demo Project/Assets/Scripts/Heap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4922e6cb6710847e596b241ed7bb5122 3 | timeCreated: 1481209631 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Demo Project/Assets/Scripts/Node.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class Node : IHeapItem { 5 | 6 | public bool walkable; 7 | public Vector2 worldPosition; 8 | public int gridX; 9 | public int gridY; 10 | 11 | public int gCost; 12 | public int hCost; 13 | public Node parent; 14 | int heapIndex; 15 | 16 | public Node(bool _walkable, Vector2 _worldPos, int _gridX, int _gridY) { 17 | walkable = _walkable; 18 | worldPosition = _worldPos; 19 | gridX = _gridX; 20 | gridY = _gridY; 21 | } 22 | 23 | public int fCost { 24 | get { 25 | return gCost + hCost; 26 | } 27 | } 28 | 29 | public int HeapIndex { 30 | get { 31 | return heapIndex; 32 | } 33 | set { 34 | heapIndex = value; 35 | } 36 | } 37 | 38 | public int CompareTo(Node nodeToCompare) { 39 | int compare = fCost.CompareTo(nodeToCompare.fCost); 40 | if (compare == 0) { 41 | compare = hCost.CompareTo(nodeToCompare.hCost); 42 | } 43 | return -compare; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Demo Project/Assets/Scripts/Node.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dedc3f0be85254c40a8e2cda2410210d 3 | timeCreated: 1481209631 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Demo Project/Assets/Scripts/Pathfinding.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System; 6 | 7 | public class Pathfinding : MonoBehaviour { 8 | 9 | Grid grid; 10 | static Pathfinding instance; 11 | 12 | void Awake() { 13 | grid = GetComponent(); 14 | instance = this; 15 | } 16 | 17 | public static Vector2[] RequestPath(Vector2 from, Vector2 to) { 18 | return instance.FindPath (from, to); 19 | } 20 | 21 | Vector2[] FindPath(Vector2 from, Vector2 to) { 22 | 23 | Stopwatch sw = new Stopwatch(); 24 | sw.Start(); 25 | 26 | Vector2[] waypoints = new Vector2[0]; 27 | bool pathSuccess = false; 28 | 29 | Node startNode = grid.NodeFromWorldPoint(from); 30 | Node targetNode = grid.NodeFromWorldPoint(to); 31 | startNode.parent = startNode; 32 | 33 | if (!startNode.walkable) { 34 | startNode = grid.ClosestWalkableNode (startNode); 35 | } 36 | if (!targetNode.walkable) { 37 | targetNode = grid.ClosestWalkableNode (targetNode); 38 | } 39 | 40 | if (startNode.walkable && targetNode.walkable) { 41 | 42 | Heap openSet = new Heap(grid.MaxSize); 43 | HashSet closedSet = new HashSet(); 44 | openSet.Add(startNode); 45 | 46 | while (openSet.Count > 0) { 47 | Node currentNode = openSet.RemoveFirst(); 48 | closedSet.Add(currentNode); 49 | 50 | if (currentNode == targetNode) { 51 | sw.Stop(); 52 | print ("Path found: " + sw.ElapsedMilliseconds + " ms"); 53 | pathSuccess = true; 54 | break; 55 | } 56 | 57 | foreach (Node neighbour in grid.GetNeighbours(currentNode)) { 58 | if (!neighbour.walkable || closedSet.Contains(neighbour)) { 59 | continue; 60 | } 61 | 62 | int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour)+TurningCost(currentNode,neighbour); 63 | if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) { 64 | neighbour.gCost = newMovementCostToNeighbour; 65 | neighbour.hCost = GetDistance(neighbour, targetNode); 66 | neighbour.parent = currentNode; 67 | 68 | if (!openSet.Contains(neighbour)) 69 | openSet.Add(neighbour); 70 | else 71 | openSet.UpdateItem(neighbour); 72 | } 73 | } 74 | } 75 | } 76 | 77 | if (pathSuccess) { 78 | waypoints = RetracePath(startNode,targetNode); 79 | } 80 | 81 | return waypoints; 82 | 83 | } 84 | 85 | 86 | int TurningCost(Node from, Node to) { 87 | /* 88 | Vector2 dirOld = new Vector2(from.gridX - from.parent.gridX, from.gridY - from.parent.gridY); 89 | Vector2 dirNew = new Vector2(to.gridX - from.gridX, to.gridY - from.gridY); 90 | if (dirNew == dirOld) 91 | return 0; 92 | else if (dirOld.x != 0 && dirOld.y != 0 && dirNew.x != 0 && dirNew.y != 0) { 93 | return 5; 94 | } 95 | else { 96 | return 10; 97 | } 98 | */ 99 | 100 | return 0; 101 | } 102 | 103 | Vector2[] RetracePath(Node startNode, Node endNode) { 104 | List path = new List(); 105 | Node currentNode = endNode; 106 | 107 | while (currentNode != startNode) { 108 | path.Add(currentNode); 109 | currentNode = currentNode.parent; 110 | } 111 | Vector2[] waypoints = SimplifyPath(path); 112 | Array.Reverse(waypoints); 113 | return waypoints; 114 | 115 | } 116 | 117 | Vector2[] SimplifyPath(List path) { 118 | List waypoints = new List(); 119 | Vector2 directionOld = Vector2.zero; 120 | 121 | for (int i = 1; i < path.Count; i ++) { 122 | Vector2 directionNew = new Vector2(path[i-1].gridX - path[i].gridX,path[i-1].gridY - path[i].gridY); 123 | if (directionNew != directionOld) { 124 | waypoints.Add(path[i].worldPosition); 125 | } 126 | directionOld = directionNew; 127 | } 128 | return waypoints.ToArray(); 129 | } 130 | 131 | int GetDistance(Node nodeA, Node nodeB) { 132 | int dstX = Mathf.Abs(nodeA.gridX - nodeB.gridX); 133 | int dstY = Mathf.Abs(nodeA.gridY - nodeB.gridY); 134 | 135 | if (dstX > dstY) 136 | return 14*dstY + 10* (dstX-dstY); 137 | return 14*dstX + 10 * (dstY-dstX); 138 | } 139 | 140 | 141 | } 142 | -------------------------------------------------------------------------------- /Demo Project/Assets/Scripts/Pathfinding.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a21e3f33d51842d29a1fc3396dbd468 3 | timeCreated: 1481209631 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Demo Project/Assets/Scripts/Unit.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class Unit : MonoBehaviour { 5 | 6 | public Transform target; 7 | public float speed = 20; 8 | 9 | Vector2[] path; 10 | int targetIndex; 11 | 12 | void Start() { 13 | StartCoroutine (RefreshPath ()); 14 | } 15 | 16 | IEnumerator RefreshPath() { 17 | Vector2 targetPositionOld = (Vector2)target.position + Vector2.up; // ensure != to target.position initially 18 | 19 | while (true) { 20 | if (targetPositionOld != (Vector2)target.position) { 21 | targetPositionOld = (Vector2)target.position; 22 | 23 | path = Pathfinding.RequestPath (transform.position, target.position); 24 | StopCoroutine ("FollowPath"); 25 | StartCoroutine ("FollowPath"); 26 | } 27 | 28 | yield return new WaitForSeconds (.25f); 29 | } 30 | } 31 | 32 | IEnumerator FollowPath() { 33 | if (path.Length > 0) { 34 | targetIndex = 0; 35 | Vector2 currentWaypoint = path [0]; 36 | 37 | while (true) { 38 | if ((Vector2)transform.position == currentWaypoint) { 39 | targetIndex++; 40 | if (targetIndex >= path.Length) { 41 | yield break; 42 | } 43 | currentWaypoint = path [targetIndex]; 44 | } 45 | 46 | transform.position = Vector2.MoveTowards (transform.position, currentWaypoint, speed * Time.deltaTime); 47 | yield return null; 48 | 49 | } 50 | } 51 | } 52 | 53 | public void OnDrawGizmos() { 54 | if (path != null) { 55 | for (int i = targetIndex; i < path.Length; i ++) { 56 | Gizmos.color = Color.black; 57 | //Gizmos.DrawCube((Vector3)path[i], Vector3.one *.5f); 58 | 59 | if (i == targetIndex) { 60 | Gizmos.DrawLine(transform.position, path[i]); 61 | } 62 | else { 63 | Gizmos.DrawLine(path[i-1],path[i]); 64 | } 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Demo Project/Assets/Scripts/Unit.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85dfd2f67d7434b78b5f716b77f72d32 3 | timeCreated: 1481209631 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Demo Project/Library/AnnotationManager: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/AnnotationManager -------------------------------------------------------------------------------- /Demo Project/Library/AssetImportState: -------------------------------------------------------------------------------- 1 | 27;0;196609;-1 -------------------------------------------------------------------------------- /Demo Project/Library/AssetServerCacheV3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/AssetServerCacheV3 -------------------------------------------------------------------------------- /Demo Project/Library/BuildPlayer.prefs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/BuildPlayer.prefs -------------------------------------------------------------------------------- /Demo Project/Library/BuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/BuildSettings.asset -------------------------------------------------------------------------------- /Demo Project/Library/CrashedAssetImports.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/CrashedAssetImports.txt -------------------------------------------------------------------------------- /Demo Project/Library/CurrentLayout.dwlt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/CurrentLayout.dwlt -------------------------------------------------------------------------------- /Demo Project/Library/EditorUserBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/EditorUserBuildSettings.asset -------------------------------------------------------------------------------- /Demo Project/Library/EditorUserSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/EditorUserSettings.asset -------------------------------------------------------------------------------- /Demo Project/Library/InspectorExpandedItems.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/InspectorExpandedItems.asset -------------------------------------------------------------------------------- /Demo Project/Library/LibraryFormatVersion.txt: -------------------------------------------------------------------------------- 1 | unityRebuildLibraryVersion: 11 2 | unityForwardCompatibleVersion: 40 3 | -------------------------------------------------------------------------------- /Demo Project/Library/MonoManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/MonoManager.asset -------------------------------------------------------------------------------- /Demo Project/Library/ScriptAssemblies/Assembly-CSharp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ScriptAssemblies/Assembly-CSharp.dll -------------------------------------------------------------------------------- /Demo Project/Library/ScriptAssemblies/Assembly-CSharp.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ScriptAssemblies/Assembly-CSharp.dll.mdb -------------------------------------------------------------------------------- /Demo Project/Library/ScriptAssemblies/BuiltinAssemblies.stamp: -------------------------------------------------------------------------------- 1 | 0000.58086cf0.0000 2 | 0000.58086d09.0000 -------------------------------------------------------------------------------- /Demo Project/Library/ScriptMapper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ScriptMapper -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/0/0f909d099790e3ce34ffec13b4698074.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/0/0f909d099790e3ce34ffec13b4698074.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/1/151af99bf62e6e277c3c7cb483b63ff6.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/1/151af99bf62e6e277c3c7cb483b63ff6.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/1/169801d8788f8d44aa88d0308c79c1c1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/1/169801d8788f8d44aa88d0308c79c1c1.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/2/246d5c253b2d0aa98e7d1974acb4198f.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/2/246d5c253b2d0aa98e7d1974acb4198f.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/2/2b2ddf76f104ca2fd52eda6c4528dcd7.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/2/2b2ddf76f104ca2fd52eda6c4528dcd7.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/3/331531103963323037c7d99fb5e6c74d.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/3/331531103963323037c7d99fb5e6c74d.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/4/47c8f232f517a175e42b10a2f8bc6ee8.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/4/47c8f232f517a175e42b10a2f8bc6ee8.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/5/52bd9272b92fde934a01bf72bf9e55cd.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/5/52bd9272b92fde934a01bf72bf9e55cd.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/5/5ebf76b0705f1af7261b08ec9fed077a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/5/5ebf76b0705f1af7261b08ec9fed077a.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/7/777d79fc3030c1569ce350b2b4503afe.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/7/777d79fc3030c1569ce350b2b4503afe.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/9/9bb6911e0f1215e08b2f899a51fa088d.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/9/9bb6911e0f1215e08b2f899a51fa088d.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/a/aa5be66ada3ec8a619d24e7e373031f9.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/a/aa5be66ada3ec8a619d24e7e373031f9.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/a/aa7a12d021084202b1b3f9ddc0cdaa60.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/a/aa7a12d021084202b1b3f9ddc0cdaa60.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/b/b2caf624bbe7e371f825bc753ac5d2f1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/b/b2caf624bbe7e371f825bc753ac5d2f1.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/b/bc987d185fa829f7760e6e0a93449b11.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/b/bc987d185fa829f7760e6e0a93449b11.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/c/c0bf546b492c3d93ea9a9a8a981a72f4.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/c/c0bf546b492c3d93ea9a9a8a981a72f4.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/c/cc1d1ee6a7754b7d814441e148ab4bc7.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/c/cc1d1ee6a7754b7d814441e148ab4bc7.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/d/d3485449d000502e6767ff6cd01fcebf.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/d/d3485449d000502e6767ff6cd01fcebf.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/d/daa0e783859a812e93dfa8e0013c3719.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/d/daa0e783859a812e93dfa8e0013c3719.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/e/e3c75c215c69cda59bf5642a7f33c79d.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/e/e3c75c215c69cda59bf5642a7f33c79d.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/e/e45d5b50a5a73a1e1301aec3376c1568.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/e/e45d5b50a5a73a1e1301aec3376c1568.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/e/e95eb3ceab8e4c3c3400917398b6b7c5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/e/e95eb3ceab8e4c3c3400917398b6b7c5.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/f/f890672bf3ff5b60accf2dccec289da9.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/f/f890672bf3ff5b60accf2dccec289da9.bin -------------------------------------------------------------------------------- /Demo Project/Library/ShaderCache/f/ffb0130abef283e98ba076625680d37d.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/ShaderCache/f/ffb0130abef283e98ba076625680d37d.bin -------------------------------------------------------------------------------- /Demo Project/Library/assetDatabase3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/assetDatabase3 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000001000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000001000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000001000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Assets 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000001000000000000000 12 | path: 13 | localIdentifier: 102900000 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1030 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000002000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000002000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000002000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: InputManager 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000002000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000003000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000003000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000003000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: TagManager 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000003000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000004000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000004000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000004000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: ProjectSettings 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000004000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000004100000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000004100000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000004100000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: NavMeshAreas 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000004100000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000005000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000005000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000005000000000000000.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000005000000000000000.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000005100000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000005100000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000005100000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Physics2DSettings 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000005100000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000006000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000006000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000006000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: AudioManager 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000006000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000006100000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000006100000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000006100000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: GraphicsSettings 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000006100000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000007000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000007000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000007000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: TimeManager 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000007000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000007100000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000007100000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000007100000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: ClusterInputManager 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000007100000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______  -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000008000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000008000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000008000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: DynamicsManager 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000008000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000008100000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000008100000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000008100000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: UnityAdsSettings 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000008100000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000009000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/00000000000000009000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/00000000000000009000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: QualitySettings 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 00000000000000009000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/0000000000000000a000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/0000000000000000a000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/0000000000000000a000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: NetworkManager 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 0000000000000000a000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/0000000000000000a100000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/0000000000000000a100000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/0000000000000000a100000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: UnityConnectSettings 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 0000000000000000a100000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ 26 |  -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/0000000000000000b000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/0000000000000000b000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/0000000000000000b000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: EditorBuildSettings 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 0000000000000000b000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______  -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/0000000000000000c000000000000000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/00/0000000000000000c000000000000000 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/00/0000000000000000c000000000000000.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: EditorSettings 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 0000000000000000c000000000000000 12 | path: 13 | localIdentifier: 5 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1038 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/0b/0b726f59db629488285572e4968789b2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/0b/0b726f59db629488285572e4968789b2 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/0b/0b726f59db629488285572e4968789b2.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Demo scene 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 0b726f59db629488285572e4968789b2 12 | path: Assets/Demo scene.unity 13 | localIdentifier: 102900000 14 | thumbnailClassID: 1032 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1030 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/12/1202d32d359e843d3ba73838b494c11f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/12/1202d32d359e843d3ba73838b494c11f -------------------------------------------------------------------------------- /Demo Project/Library/metadata/12/1202d32d359e843d3ba73838b494c11f.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/12/1202d32d359e843d3ba73838b494c11f.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/1a/1a3a0e3f16d3945268a3d9141742bd04: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/1a/1a3a0e3f16d3945268a3d9141742bd04 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/1a/1a3a0e3f16d3945268a3d9141742bd04.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Grid 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 1a3a0e3f16d3945268a3d9141742bd04 12 | path: Assets/Scripts/Grid.cs 13 | localIdentifier: 11500000 14 | thumbnailClassID: 115 15 | flags: 0 16 | scriptClassName: Grid 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1035 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/2f/2fe6938f04445463bb8f1d008e3cc672: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/2f/2fe6938f04445463bb8f1d008e3cc672 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/2f/2fe6938f04445463bb8f1d008e3cc672.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/2f/2fe6938f04445463bb8f1d008e3cc672.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/3c/3c0ad459c1534645b5d603b7cc258f97: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/3c/3c0ad459c1534645b5d603b7cc258f97 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/3c/3c0ad459c1534645b5d603b7cc258f97.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/3c/3c0ad459c1534645b5d603b7cc258f97.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/42/424cb0975868e49da970af86793d23b6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/42/424cb0975868e49da970af86793d23b6 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/42/424cb0975868e49da970af86793d23b6.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Scripts 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 424cb0975868e49da970af86793d23b6 12 | path: Assets/Scripts 13 | localIdentifier: 102900000 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1030 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/49/4922e6cb6710847e596b241ed7bb5122: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/49/4922e6cb6710847e596b241ed7bb5122 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/49/4922e6cb6710847e596b241ed7bb5122.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Heap 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 4922e6cb6710847e596b241ed7bb5122 12 | path: Assets/Scripts/Heap.cs 13 | localIdentifier: 11500000 14 | thumbnailClassID: 115 15 | flags: 0 16 | scriptClassName: Heap 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1035 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/5f/5f32cd94baa94578a686d4b9d6b660f7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/5f/5f32cd94baa94578a686d4b9d6b660f7 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/5f/5f32cd94baa94578a686d4b9d6b660f7.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/5f/5f32cd94baa94578a686d4b9d6b660f7.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/6a/6a21e3f33d51842d29a1fc3396dbd468: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/6a/6a21e3f33d51842d29a1fc3396dbd468 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/6a/6a21e3f33d51842d29a1fc3396dbd468.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Pathfinding 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 6a21e3f33d51842d29a1fc3396dbd468 12 | path: Assets/Scripts/Pathfinding.cs 13 | localIdentifier: 11500000 14 | thumbnailClassID: 115 15 | flags: 0 16 | scriptClassName: Pathfinding 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1035 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______/ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/73/739bbd9f364b4268874f9fd86ab3beef: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/73/739bbd9f364b4268874f9fd86ab3beef -------------------------------------------------------------------------------- /Demo Project/Library/metadata/73/739bbd9f364b4268874f9fd86ab3beef.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/73/739bbd9f364b4268874f9fd86ab3beef.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/7c/7cbab2be89b54486bbd23a6fe637d30e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/7c/7cbab2be89b54486bbd23a6fe637d30e -------------------------------------------------------------------------------- /Demo Project/Library/metadata/7c/7cbab2be89b54486bbd23a6fe637d30e.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: nunit.framework 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 7cbab2be89b54486bbd23a6fe637d30e 12 | path: 13 | localIdentifier: -1121539586 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1050 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/80/80a3616ca19596e4da0f10f14d241e9f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/80/80a3616ca19596e4da0f10f14d241e9f -------------------------------------------------------------------------------- /Demo Project/Library/metadata/80/80a3616ca19596e4da0f10f14d241e9f.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/80/80a3616ca19596e4da0f10f14d241e9f.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/85/852e56802eb941638acbb491814497b0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/85/852e56802eb941638acbb491814497b0 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/85/852e56802eb941638acbb491814497b0.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: UnityEngine.Analytics 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 852e56802eb941638acbb491814497b0 12 | path: 13 | localIdentifier: -1121539586 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1050 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/85/85dfd2f67d7434b78b5f716b77f72d32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/85/85dfd2f67d7434b78b5f716b77f72d32 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/85/85dfd2f67d7434b78b5f716b77f72d32.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Unit 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 85dfd2f67d7434b78b5f716b77f72d32 12 | path: Assets/Scripts/Unit.cs 13 | localIdentifier: 11500000 14 | thumbnailClassID: 115 15 | flags: 0 16 | scriptClassName: Unit 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1035 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/86/86a1e01bfe79445f0985df1b1caa41fb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/86/86a1e01bfe79445f0985df1b1caa41fb -------------------------------------------------------------------------------- /Demo Project/Library/metadata/86/86a1e01bfe79445f0985df1b1caa41fb.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/86/86a1e01bfe79445f0985df1b1caa41fb.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/87/870353891bb340e2b2a9c8707e7419ba: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/87/870353891bb340e2b2a9c8707e7419ba -------------------------------------------------------------------------------- /Demo Project/Library/metadata/87/870353891bb340e2b2a9c8707e7419ba.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/87/870353891bb340e2b2a9c8707e7419ba.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/8e/8e0cd8ed44d4412cbe0642067abc9e44: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/8e/8e0cd8ed44d4412cbe0642067abc9e44 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/8e/8e0cd8ed44d4412cbe0642067abc9e44.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/8e/8e0cd8ed44d4412cbe0642067abc9e44.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/97/97decbdab0634cdd991f8d23ddf0dead: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/97/97decbdab0634cdd991f8d23ddf0dead -------------------------------------------------------------------------------- /Demo Project/Library/metadata/97/97decbdab0634cdd991f8d23ddf0dead.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: UnityEditor.Advertisements 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: 97decbdab0634cdd991f8d23ddf0dead 12 | path: 13 | localIdentifier: -1121539586 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1050 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/ad/adebbd281f1a4ef3a30be7f21937e02f: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/ad/adebbd281f1a4ef3a30be7f21937e02f -------------------------------------------------------------------------------- /Demo Project/Library/metadata/ad/adebbd281f1a4ef3a30be7f21937e02f.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/ad/adebbd281f1a4ef3a30be7f21937e02f.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/b5/b544c8c8b79e04b06983aab1c75bd87c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/b5/b544c8c8b79e04b06983aab1c75bd87c -------------------------------------------------------------------------------- /Demo Project/Library/metadata/b5/b544c8c8b79e04b06983aab1c75bd87c.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Materials 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: b544c8c8b79e04b06983aab1c75bd87c 12 | path: Assets/Materials 13 | localIdentifier: 102900000 14 | thumbnailClassID: 1029 15 | flags: 0 16 | scriptClassName: 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1030 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/c9/c905570c753f941cdb9928ddf601b830: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/c9/c905570c753f941cdb9928ddf601b830 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/c9/c905570c753f941cdb9928ddf601b830.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/c9/c905570c753f941cdb9928ddf601b830.info -------------------------------------------------------------------------------- /Demo Project/Library/metadata/de/dedc3f0be85254c40a8e2cda2410210d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/de/dedc3f0be85254c40a8e2cda2410210d -------------------------------------------------------------------------------- /Demo Project/Library/metadata/de/dedc3f0be85254c40a8e2cda2410210d.info: -------------------------------------------------------------------------------- 1 | PreviewAssetDataBaseName: 2 | mainRepresentation: 3 | name: Node 4 | thumbnail: 5 | m_Format: 0 6 | m_Width: 0 7 | m_Height: 0 8 | m_RowBytes: 0 9 | image data: 0 10 | _typelessdata: 11 | guid: dedc3f0be85254c40a8e2cda2410210d 12 | path: Assets/Scripts/Node.cs 13 | localIdentifier: 11500000 14 | thumbnailClassID: 115 15 | flags: 0 16 | scriptClassName: Node 17 | representations: [] 18 | labels: 19 | m_Labels: [] 20 | assetImporterClassID: 1035 21 | assetBundleFullName: 22 | m_AssetBundleName: 23 | m_AssetBundleVariant: 24 | externalReferencesForValidation: [] 25 | AssetInfo_______ -------------------------------------------------------------------------------- /Demo Project/Library/metadata/f5/f5f67c52d1564df4a8936ccd202a3bd8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/f5/f5f67c52d1564df4a8936ccd202a3bd8 -------------------------------------------------------------------------------- /Demo Project/Library/metadata/f5/f5f67c52d1564df4a8936ccd202a3bd8.info: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/Library/metadata/f5/f5f67c52d1564df4a8936ccd202a3bd8.info -------------------------------------------------------------------------------- /Demo Project/Library/shadercompiler-UnityShaderCompiler0.log: -------------------------------------------------------------------------------- 1 | Base path: /Applications/Unity/Unity.app/Contents 2 | Cmd: getPlatforms 3 | Cmd: compileSnippet 4 | api=15 type=0 insize=1250 outsize=2099 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 5 | Cmd: compileSnippet 6 | api=15 type=1 insize=1250 outsize=0 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 7 | Cmd: compileSnippet 8 | api=15 type=0 insize=1261 outsize=2152 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 9 | Cmd: compileSnippet 10 | api=15 type=1 insize=1261 outsize=0 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 11 | Cmd: compileSnippet 12 | api=15 type=0 insize=13041 outsize=10238 kw=UNITY_COLORSPACE_GAMMA _SUNDISK_SIMPLE pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 13 | Cmd: compileSnippet 14 | api=15 type=1 insize=13041 outsize=0 kw=UNITY_COLORSPACE_GAMMA _SUNDISK_SIMPLE pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 15 | Cmd: compileSnippet 16 | api=15 type=0 insize=1283 outsize=2046 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 17 | Cmd: compileSnippet 18 | api=15 type=1 insize=1283 outsize=0 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 19 | Cmd: compileSnippet 20 | api=15 type=0 insize=927 outsize=1207 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 21 | Cmd: compileSnippet 22 | api=15 type=1 insize=927 outsize=0 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 23 | Cmd: compileSnippet 24 | api=15 type=0 insize=1456 outsize=1199 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 25 | Cmd: compileSnippet 26 | api=15 type=1 insize=1456 outsize=0 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 27 | Cmd: compileSnippet 28 | api=15 type=0 insize=608 outsize=3357 kw=SHADOWS_DEPTH pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 29 | Cmd: compileSnippet 30 | api=15 type=1 insize=608 outsize=0 kw=SHADOWS_DEPTH pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 31 | Cmd: compileSnippet 32 | api=15 type=0 insize=986 outsize=14845 kw=DIRECTIONAL LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 33 | Cmd: compileSnippet 34 | api=15 type=1 insize=986 outsize=0 kw=DIRECTIONAL LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 35 | Cmd: compileSnippet 36 | api=15 type=0 insize=912 outsize=7111 kw=DIRECTIONAL pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 37 | Cmd: compileSnippet 38 | api=15 type=1 insize=912 outsize=0 kw=DIRECTIONAL pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 39 | Cmd: compileSnippet 40 | api=15 type=0 insize=986 outsize=15056 kw=DIRECTIONAL LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF _EMISSION pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 41 | Cmd: compileSnippet 42 | api=15 type=1 insize=986 outsize=0 kw=DIRECTIONAL LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF _EMISSION pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 43 | Cmd: compileSnippet 44 | api=15 type=0 insize=833 outsize=990 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 45 | Cmd: compileSnippet 46 | api=15 type=1 insize=833 outsize=0 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 47 | Cmd: compileSnippet 48 | api=15 type=0 insize=839 outsize=818 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 49 | Cmd: compileSnippet 50 | api=15 type=1 insize=839 outsize=0 kw= pd=UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP ok=1 51 | -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.4.2f2 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/UnityAdsSettings.asset -------------------------------------------------------------------------------- /Demo Project/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SebLague/Pathfinding-2D/a810ee22fb341524eb93caa6c5da09f3a4b460cf/Demo Project/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Sebastian Lague 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Scripts/Grid.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | public class Grid : MonoBehaviour { 6 | 7 | public bool displayGridGizmos; 8 | 9 | public LayerMask unwalkableMask; 10 | public Vector2 gridWorldSize; 11 | public float nodeRadius; 12 | 13 | Node[,] grid; 14 | float nodeDiameter; 15 | int gridSizeX, gridSizeY; 16 | 17 | void Awake() { 18 | nodeDiameter = nodeRadius*2; 19 | gridSizeX = Mathf.RoundToInt(gridWorldSize.x/nodeDiameter); 20 | gridSizeY = Mathf.RoundToInt(gridWorldSize.y/nodeDiameter); 21 | 22 | CreateGrid(); 23 | } 24 | 25 | public int MaxSize { 26 | get { 27 | return gridSizeX * gridSizeY; 28 | } 29 | } 30 | 31 | void CreateGrid() { 32 | grid = new Node[gridSizeX,gridSizeY]; 33 | Vector2 worldBottomLeft = (Vector2)transform.position - Vector2.right * gridWorldSize.x/2 - Vector2.up * gridWorldSize.y/2; 34 | 35 | for (int x = 0; x < gridSizeX; x ++) { 36 | for (int y = 0; y < gridSizeY; y ++) { 37 | Vector2 worldPoint = worldBottomLeft + Vector2.right * (x * nodeDiameter + nodeRadius) + Vector2.up * (y * nodeDiameter + nodeRadius); 38 | bool walkable = (Physics2D.OverlapCircle(worldPoint,nodeRadius,unwalkableMask) == null); // if no collider2D is returned by overlap circle, then this node is walkable 39 | 40 | grid[x,y] = new Node(walkable,worldPoint, x,y); 41 | } 42 | } 43 | } 44 | 45 | 46 | public List GetNeighbours(Node node, int depth = 1) { 47 | List neighbours = new List(); 48 | 49 | for (int x = -depth; x <= depth; x++) { 50 | for (int y = -depth; y <= depth; y++) { 51 | if (x == 0 && y == 0) 52 | continue; 53 | 54 | int checkX = node.gridX + x; 55 | int checkY = node.gridY + y; 56 | 57 | if (checkX >= 0 && checkX < gridSizeX && checkY >= 0 && checkY < gridSizeY) { 58 | neighbours.Add(grid[checkX,checkY]); 59 | } 60 | } 61 | } 62 | 63 | return neighbours; 64 | } 65 | 66 | 67 | public Node NodeFromWorldPoint(Vector2 worldPosition) { 68 | float percentX = (worldPosition.x + gridWorldSize.x/2) / gridWorldSize.x; 69 | float percentY = (worldPosition.y + gridWorldSize.y/2) / gridWorldSize.y; 70 | percentX = Mathf.Clamp01(percentX); 71 | percentY = Mathf.Clamp01(percentY); 72 | 73 | int x = Mathf.RoundToInt((gridSizeX-1) * percentX); 74 | int y = Mathf.RoundToInt((gridSizeY-1) * percentY); 75 | return grid[x,y]; 76 | } 77 | 78 | public Node ClosestWalkableNode(Node node) { 79 | int maxRadius = Mathf.Max (gridSizeX, gridSizeY) / 2; 80 | for (int i = 1; i < maxRadius; i++) { 81 | Node n = FindWalkableInRadius (node.gridX, node.gridY, i); 82 | if (n != null) { 83 | return n; 84 | 85 | } 86 | } 87 | return null; 88 | } 89 | Node FindWalkableInRadius(int centreX, int centreY, int radius) { 90 | 91 | for (int i = -radius; i <= radius; i ++) { 92 | int verticalSearchX = i + centreX; 93 | int horizontalSearchY = i + centreY; 94 | 95 | // top 96 | if (InBounds(verticalSearchX, centreY + radius)) { 97 | if (grid[verticalSearchX, centreY + radius].walkable) { 98 | return grid [verticalSearchX, centreY + radius]; 99 | } 100 | } 101 | 102 | // bottom 103 | if (InBounds(verticalSearchX, centreY - radius)) { 104 | if (grid[verticalSearchX, centreY - radius].walkable) { 105 | return grid [verticalSearchX, centreY - radius]; 106 | } 107 | } 108 | // right 109 | if (InBounds(centreY + radius, horizontalSearchY)) { 110 | if (grid[centreX + radius, horizontalSearchY].walkable) { 111 | return grid [centreX + radius, horizontalSearchY]; 112 | } 113 | } 114 | 115 | // left 116 | if (InBounds(centreY - radius, horizontalSearchY)) { 117 | if (grid[centreX - radius, horizontalSearchY].walkable) { 118 | return grid [centreX - radius, horizontalSearchY]; 119 | } 120 | } 121 | 122 | } 123 | 124 | return null; 125 | 126 | } 127 | 128 | bool InBounds(int x, int y) { 129 | return x>=0 && x= 0 && y where T : IHeapItem { 6 | 7 | T[] items; 8 | int currentItemCount; 9 | 10 | public Heap(int maxHeapSize) { 11 | items = new T[maxHeapSize]; 12 | } 13 | 14 | public void Add(T item) { 15 | item.HeapIndex = currentItemCount; 16 | items[currentItemCount] = item; 17 | SortUp(item); 18 | currentItemCount++; 19 | } 20 | 21 | public T RemoveFirst() { 22 | T firstItem = items[0]; 23 | currentItemCount--; 24 | items[0] = items[currentItemCount]; 25 | items[0].HeapIndex = 0; 26 | SortDown(items[0]); 27 | return firstItem; 28 | } 29 | 30 | public void UpdateItem(T item) { 31 | SortUp(item); 32 | } 33 | 34 | public int Count { 35 | get { 36 | return currentItemCount; 37 | } 38 | } 39 | 40 | public bool Contains(T item) { 41 | return Equals(items[item.HeapIndex], item); 42 | } 43 | 44 | void SortDown(T item) { 45 | while (true) { 46 | int childIndexLeft = item.HeapIndex * 2 + 1; 47 | int childIndexRight = item.HeapIndex * 2 + 2; 48 | int swapIndex = 0; 49 | 50 | if (childIndexLeft < currentItemCount) { 51 | swapIndex = childIndexLeft; 52 | 53 | if (childIndexRight < currentItemCount) { 54 | if (items[childIndexLeft].CompareTo(items[childIndexRight]) < 0) { 55 | swapIndex = childIndexRight; 56 | } 57 | } 58 | 59 | if (item.CompareTo(items[swapIndex]) < 0) { 60 | Swap (item,items[swapIndex]); 61 | } 62 | else { 63 | return; 64 | } 65 | 66 | } 67 | else { 68 | return; 69 | } 70 | 71 | } 72 | } 73 | 74 | void SortUp(T item) { 75 | int parentIndex = (item.HeapIndex-1)/2; 76 | 77 | while (true) { 78 | T parentItem = items[parentIndex]; 79 | if (item.CompareTo(parentItem) > 0) { 80 | Swap (item,parentItem); 81 | } 82 | else { 83 | break; 84 | } 85 | 86 | parentIndex = (item.HeapIndex-1)/2; 87 | } 88 | } 89 | 90 | void Swap(T itemA, T itemB) { 91 | items[itemA.HeapIndex] = itemB; 92 | items[itemB.HeapIndex] = itemA; 93 | int itemAIndex = itemA.HeapIndex; 94 | itemA.HeapIndex = itemB.HeapIndex; 95 | itemB.HeapIndex = itemAIndex; 96 | } 97 | 98 | 99 | 100 | } 101 | 102 | public interface IHeapItem : IComparable { 103 | int HeapIndex { 104 | get; 105 | set; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Scripts/Node.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class Node : IHeapItem { 5 | 6 | public bool walkable; 7 | public Vector2 worldPosition; 8 | public int gridX; 9 | public int gridY; 10 | 11 | public int gCost; 12 | public int hCost; 13 | public Node parent; 14 | int heapIndex; 15 | 16 | public Node(bool _walkable, Vector2 _worldPos, int _gridX, int _gridY) { 17 | walkable = _walkable; 18 | worldPosition = _worldPos; 19 | gridX = _gridX; 20 | gridY = _gridY; 21 | } 22 | 23 | public int fCost { 24 | get { 25 | return gCost + hCost; 26 | } 27 | } 28 | 29 | public int HeapIndex { 30 | get { 31 | return heapIndex; 32 | } 33 | set { 34 | heapIndex = value; 35 | } 36 | } 37 | 38 | public int CompareTo(Node nodeToCompare) { 39 | int compare = fCost.CompareTo(nodeToCompare.fCost); 40 | if (compare == 0) { 41 | compare = hCost.CompareTo(nodeToCompare.hCost); 42 | } 43 | return -compare; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Scripts/Pathfinding.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System; 6 | 7 | public class Pathfinding : MonoBehaviour { 8 | 9 | Grid grid; 10 | static Pathfinding instance; 11 | 12 | void Awake() { 13 | grid = GetComponent(); 14 | instance = this; 15 | } 16 | 17 | public static Vector2[] RequestPath(Vector2 from, Vector2 to) { 18 | return instance.FindPath (from, to); 19 | } 20 | 21 | Vector2[] FindPath(Vector2 from, Vector2 to) { 22 | 23 | Stopwatch sw = new Stopwatch(); 24 | sw.Start(); 25 | 26 | Vector2[] waypoints = new Vector2[0]; 27 | bool pathSuccess = false; 28 | 29 | Node startNode = grid.NodeFromWorldPoint(from); 30 | Node targetNode = grid.NodeFromWorldPoint(to); 31 | startNode.parent = startNode; 32 | 33 | if (!startNode.walkable) { 34 | startNode = grid.ClosestWalkableNode (startNode); 35 | } 36 | if (!targetNode.walkable) { 37 | targetNode = grid.ClosestWalkableNode (targetNode); 38 | } 39 | 40 | if (startNode.walkable && targetNode.walkable) { 41 | 42 | Heap openSet = new Heap(grid.MaxSize); 43 | HashSet closedSet = new HashSet(); 44 | openSet.Add(startNode); 45 | 46 | while (openSet.Count > 0) { 47 | Node currentNode = openSet.RemoveFirst(); 48 | closedSet.Add(currentNode); 49 | 50 | if (currentNode == targetNode) { 51 | sw.Stop(); 52 | print ("Path found: " + sw.ElapsedMilliseconds + " ms"); 53 | pathSuccess = true; 54 | break; 55 | } 56 | 57 | foreach (Node neighbour in grid.GetNeighbours(currentNode)) { 58 | if (!neighbour.walkable || closedSet.Contains(neighbour)) { 59 | continue; 60 | } 61 | 62 | int newMovementCostToNeighbour = currentNode.gCost + GetDistance(currentNode, neighbour)+TurningCost(currentNode,neighbour); 63 | if (newMovementCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) { 64 | neighbour.gCost = newMovementCostToNeighbour; 65 | neighbour.hCost = GetDistance(neighbour, targetNode); 66 | neighbour.parent = currentNode; 67 | 68 | if (!openSet.Contains(neighbour)) 69 | openSet.Add(neighbour); 70 | else 71 | openSet.UpdateItem(neighbour); 72 | } 73 | } 74 | } 75 | } 76 | 77 | if (pathSuccess) { 78 | waypoints = RetracePath(startNode,targetNode); 79 | } 80 | 81 | return waypoints; 82 | 83 | } 84 | 85 | 86 | int TurningCost(Node from, Node to) { 87 | /* 88 | Vector2 dirOld = new Vector2(from.gridX - from.parent.gridX, from.gridY - from.parent.gridY); 89 | Vector2 dirNew = new Vector2(to.gridX - from.gridX, to.gridY - from.gridY); 90 | if (dirNew == dirOld) 91 | return 0; 92 | else if (dirOld.x != 0 && dirOld.y != 0 && dirNew.x != 0 && dirNew.y != 0) { 93 | return 5; 94 | } 95 | else { 96 | return 10; 97 | } 98 | */ 99 | 100 | return 0; 101 | } 102 | 103 | Vector2[] RetracePath(Node startNode, Node endNode) { 104 | List path = new List(); 105 | Node currentNode = endNode; 106 | 107 | while (currentNode != startNode) { 108 | path.Add(currentNode); 109 | currentNode = currentNode.parent; 110 | } 111 | Vector2[] waypoints = SimplifyPath(path); 112 | Array.Reverse(waypoints); 113 | return waypoints; 114 | 115 | } 116 | 117 | Vector2[] SimplifyPath(List path) { 118 | List waypoints = new List(); 119 | Vector2 directionOld = Vector2.zero; 120 | 121 | for (int i = 1; i < path.Count; i ++) { 122 | Vector2 directionNew = new Vector2(path[i-1].gridX - path[i].gridX,path[i-1].gridY - path[i].gridY); 123 | if (directionNew != directionOld) { 124 | waypoints.Add(path[i].worldPosition); 125 | } 126 | directionOld = directionNew; 127 | } 128 | return waypoints.ToArray(); 129 | } 130 | 131 | int GetDistance(Node nodeA, Node nodeB) { 132 | int dstX = Mathf.Abs(nodeA.gridX - nodeB.gridX); 133 | int dstY = Mathf.Abs(nodeA.gridY - nodeB.gridY); 134 | 135 | if (dstX > dstY) 136 | return 14*dstY + 10* (dstX-dstY); 137 | return 14*dstX + 10 * (dstY-dstX); 138 | } 139 | 140 | 141 | } 142 | -------------------------------------------------------------------------------- /Scripts/Unit.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class Unit : MonoBehaviour { 5 | 6 | public Transform target; 7 | public float speed = 20; 8 | 9 | Vector2[] path; 10 | int targetIndex; 11 | 12 | void Start() { 13 | StartCoroutine (RefreshPath ()); 14 | } 15 | 16 | IEnumerator RefreshPath() { 17 | Vector2 targetPositionOld = (Vector2)target.position + Vector2.up; // ensure != to target.position initially 18 | 19 | while (true) { 20 | if (targetPositionOld != (Vector2)target.position) { 21 | targetPositionOld = (Vector2)target.position; 22 | 23 | path = Pathfinding.RequestPath (transform.position, target.position); 24 | StopCoroutine ("FollowPath"); 25 | StartCoroutine ("FollowPath"); 26 | } 27 | 28 | yield return new WaitForSeconds (.25f); 29 | } 30 | } 31 | 32 | IEnumerator FollowPath() { 33 | if (path.Length > 0) { 34 | targetIndex = 0; 35 | Vector2 currentWaypoint = path [0]; 36 | 37 | while (true) { 38 | if ((Vector2)transform.position == currentWaypoint) { 39 | targetIndex++; 40 | if (targetIndex >= path.Length) { 41 | yield break; 42 | } 43 | currentWaypoint = path [targetIndex]; 44 | } 45 | 46 | transform.position = Vector2.MoveTowards (transform.position, currentWaypoint, speed * Time.deltaTime); 47 | yield return null; 48 | 49 | } 50 | } 51 | } 52 | 53 | public void OnDrawGizmos() { 54 | if (path != null) { 55 | for (int i = targetIndex; i < path.Length; i ++) { 56 | Gizmos.color = Color.black; 57 | //Gizmos.DrawCube((Vector3)path[i], Vector3.one *.5f); 58 | 59 | if (i == targetIndex) { 60 | Gizmos.DrawLine(transform.position, path[i]); 61 | } 62 | else { 63 | Gizmos.DrawLine(path[i-1],path[i]); 64 | } 65 | } 66 | } 67 | } 68 | } 69 | --------------------------------------------------------------------------------