Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Episode 03 - astar/Assets/Scripts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class Grid : MonoBehaviour {
public Vector2 gridWorldSize;
public float nodeRadius;
Node[,] grid;
List<Node> neighbours = new List<Node>();

float nodeDiameter;
int gridSizeX, gridSizeY;
Expand All @@ -33,7 +34,7 @@ void CreateGrid() {
}

public List<Node> GetNeighbours(Node node) {
List<Node> neighbours = new List<Node>();
neighbours.Clear();

for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
Expand Down
3 changes: 2 additions & 1 deletion Episode 04 - heap/Assets/Scripts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Grid : MonoBehaviour {
public Vector2 gridWorldSize;
public float nodeRadius;
Node[,] grid;
List<Node> neighbours = new List<Node>();

float nodeDiameter;
int gridSizeX, gridSizeY;
Expand Down Expand Up @@ -40,7 +41,7 @@ void CreateGrid() {
}

public List<Node> GetNeighbours(Node node) {
List<Node> neighbours = new List<Node>();
neighbours.Clear();

for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
Expand Down
3 changes: 2 additions & 1 deletion Episode 05 - units/Assets/Scripts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Grid : MonoBehaviour {
public Vector2 gridWorldSize;
public float nodeRadius;
Node[,] grid;
List<Node> neighbours = new List<Node>();

float nodeDiameter;
int gridSizeX, gridSizeY;
Expand Down Expand Up @@ -40,7 +41,7 @@ void CreateGrid() {
}

public List<Node> GetNeighbours(Node node) {
List<Node> neighbours = new List<Node>();
neighbours.Clear();

for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
Expand Down
3 changes: 2 additions & 1 deletion Episode 10 - threading/Assets/Scripts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Grid : MonoBehaviour {
public int obstacleProximityPenalty = 10;
Dictionary<int,int> walkableRegionsDictionary = new Dictionary<int, int>();
LayerMask walkableMask;
List<Node> neighbours = new List<Node>();

Node[,] grid;

Expand Down Expand Up @@ -121,7 +122,7 @@ void BlurPenaltyMap(int blurSize) {
}

public List<Node> GetNeighbours(Node node) {
List<Node> neighbours = new List<Node>();
neighbours.Clear();

for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void RequestPath(PathRequest request) {
ThreadStart threadStart = delegate {
instance.pathfinding.FindPath (request, instance.FinishedProcessingPath);
};
threadStart.Invoke ();
new Thread(threadStart).Start();
}

public void FinishedProcessingPath(PathResult result) {
Expand Down
3 changes: 2 additions & 1 deletion Episode 6 - weights/Assets/Scripts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class Grid : MonoBehaviour {
public TerrainType[] walkableRegions;
Dictionary<int,int> walkableRegionsDictionary = new Dictionary<int, int>();
LayerMask walkableMask;
List<Node> neighbours = new List<Node>();

Node[,] grid;

Expand Down Expand Up @@ -61,7 +62,7 @@ void CreateGrid() {
}

public List<Node> GetNeighbours(Node node) {
List<Node> neighbours = new List<Node>();
neighbours.Clear();

for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
Expand Down
3 changes: 2 additions & 1 deletion Episode 7 - smooth weights/Assets/Scripts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Grid : MonoBehaviour {
public int obstacleProximityPenalty = 10;
Dictionary<int,int> walkableRegionsDictionary = new Dictionary<int, int>();
LayerMask walkableMask;
List<Node> neighbours = new List<Node>();

Node[,] grid;

Expand Down Expand Up @@ -121,7 +122,7 @@ void BlurPenaltyMap(int blurSize) {
}

public List<Node> GetNeighbours(Node node) {
List<Node> neighbours = new List<Node>();
neighbours.Clear();

for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
Expand Down
3 changes: 2 additions & 1 deletion Episode 8 - smooth path/Assets/Scripts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Grid : MonoBehaviour {
public int obstacleProximityPenalty = 10;
Dictionary<int,int> walkableRegionsDictionary = new Dictionary<int, int>();
LayerMask walkableMask;
List<Node> neighbours = new List<Node>();

Node[,] grid;

Expand Down Expand Up @@ -121,7 +122,7 @@ void BlurPenaltyMap(int blurSize) {
}

public List<Node> GetNeighbours(Node node) {
List<Node> neighbours = new List<Node>();
neighbours.Clear();

for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
Expand Down
3 changes: 2 additions & 1 deletion Episode 9 - smooth path 02/Assets/Scripts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Grid : MonoBehaviour {
public int obstacleProximityPenalty = 10;
Dictionary<int,int> walkableRegionsDictionary = new Dictionary<int, int>();
LayerMask walkableMask;
List<Node> neighbours = new List<Node>();

Node[,] grid;

Expand Down Expand Up @@ -121,7 +122,7 @@ void BlurPenaltyMap(int blurSize) {
}

public List<Node> GetNeighbours(Node node) {
List<Node> neighbours = new List<Node>();
neighbours.Clear();

for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
Expand Down