Cannot Walk Through Monsters
This commit is contained in:
@@ -100,6 +100,8 @@ namespace DepthsBelow
|
||||
MouseInput.LoadContent();
|
||||
KeyboardInput = new KeyboardInput(this);
|
||||
|
||||
Swarm.Add(TestMonster);
|
||||
|
||||
TestMonster.X = 12;
|
||||
TestMonster.Y = 4;
|
||||
|
||||
|
||||
@@ -104,6 +104,13 @@ namespace DepthsBelow
|
||||
soldierCollisions.Add(soldier.Transform.Grid);
|
||||
}
|
||||
}
|
||||
foreach (var enemy in core.Swarm)
|
||||
{
|
||||
if (!enemy.GetComponent<PathFinder>().IsMoving)
|
||||
{
|
||||
soldierCollisions.Add(enemy.Transform.Grid);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var soldier in Squad)
|
||||
{
|
||||
@@ -120,6 +127,18 @@ namespace DepthsBelow
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var enemy in core.Swarm)
|
||||
{
|
||||
var pathFinder = enemy.GetComponent<PathFinder>();
|
||||
var position = nextNode.Position;
|
||||
if (enemy.Transform.Grid == position)
|
||||
{
|
||||
soldierCollisions.Add(enemy.Transform.Grid);
|
||||
GetComponent<PathFinder>().RecreatePath(soldierCollisions);
|
||||
nextNode = GetComponent<PathFinder>().Next();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nextNode != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user