SPIRAL BY CHRISTIAN

This commit is contained in:
Simon Holmberg
2012-10-29 02:49:26 +00:00
parent 236d6c2859
commit 600661b911
2 changed files with 607 additions and 533 deletions
File diff suppressed because it is too large Load Diff
+33 -23
View File
@@ -113,30 +113,40 @@ namespace DepthsBelow
List<Point> soldierCollisions = new List<Point>(); List<Point> soldierCollisions = new List<Point>();
// Collision with units at a standstill // Collision with units at a standstill
foreach (var soldier in Squad) //foreach (var soldier in Squad)
{ //{
if (soldier != this && !soldier.GetComponent<PathFinder>().IsMoving) // if (soldier != this)
{ // {
soldierCollisions.Add(soldier.Transform.Grid); // if (!soldier.GetComponent<PathFinder>().IsMoving)
} // {
} // soldierCollisions.Add(soldier.Transform.Grid);
// }
// if (soldier.Transform.Grid == nextNode.Position)
// {
// GetComponent<PathFinder>().RecreatePath(soldierCollisions);
// nextNode = GetComponent<PathFinder>().Next();
// break;
// }
// }
// Collision with moving units //}
foreach (var soldier in Squad)
{ // Collision with moving units
if (soldier != this) //foreach (var soldier in Squad)
{ //{
var pathFinder = soldier.GetComponent<PathFinder>(); // if (soldier != this)
var position = nextNode.Position; // {
if (soldier.Transform.Grid == position) // var pathFinder = soldier.GetComponent<PathFinder>();
{ // var position = nextNode.Position;
soldierCollisions.Add(soldier.Transform.Grid); // if (soldier.Transform.Grid == position)
GetComponent<PathFinder>().RecreatePath(soldierCollisions); // {
nextNode = GetComponent<PathFinder>().Next(); // soldierCollisions.Add(soldier.Transform.Grid);
break; // GetComponent<PathFinder>().RecreatePath(soldierCollisions);
} // nextNode = GetComponent<PathFinder>().Next();
} // break;
} // }
// }
//}
if (nextNode != null) if (nextNode != null)
{ {