Monster will stop beside soldier and not on top
This commit is contained in:
@@ -43,6 +43,7 @@ namespace DepthsBelow
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
core.TestMonster.step = 0;
|
||||||
core.PlayerTurn = false;
|
core.PlayerTurn = false;
|
||||||
Point target = Point.Zero;
|
Point target = Point.Zero;
|
||||||
int distance = 7000;
|
int distance = 7000;
|
||||||
|
|||||||
@@ -18,6 +18,18 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
private PathFinder.Node nextNode;
|
private PathFinder.Node nextNode;
|
||||||
|
|
||||||
|
public int numberOfSteps = 5;
|
||||||
|
public int currentStep = 0;
|
||||||
|
|
||||||
|
public int step
|
||||||
|
{
|
||||||
|
get { return currentStep; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
currentStep = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SmallEnemy(Core core, ref List<SmallEnemy> swarm)
|
public SmallEnemy(Core core, ref List<SmallEnemy> swarm)
|
||||||
: base(core)
|
: base(core)
|
||||||
{
|
{
|
||||||
@@ -81,6 +93,19 @@ namespace DepthsBelow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var soldier in core.Squad)
|
||||||
|
{
|
||||||
|
var pathFinder = soldier.GetComponent<PathFinder>();
|
||||||
|
var position = nextNode.Position;
|
||||||
|
if (soldier.Transform.Grid == position)
|
||||||
|
{
|
||||||
|
soldierCollisions.Add(soldier.Transform.Grid);
|
||||||
|
GetComponent<PathFinder>().RecreatePath(soldierCollisions);
|
||||||
|
nextNode = GetComponent<PathFinder>().Next();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (nextNode != null)
|
if (nextNode != null)
|
||||||
{
|
{
|
||||||
var nodeWorldPos = Grid.GridToWorld(nextNode.Position);
|
var nodeWorldPos = Grid.GridToWorld(nextNode.Position);
|
||||||
@@ -96,7 +121,19 @@ namespace DepthsBelow
|
|||||||
Transform.World.Y -= speed;
|
Transform.World.Y -= speed;
|
||||||
|
|
||||||
if (Transform.World == nodeWorldPos)
|
if (Transform.World == nodeWorldPos)
|
||||||
nextNode = GetComponent<PathFinder>().Next();
|
{
|
||||||
|
if (currentStep < numberOfSteps)
|
||||||
|
{
|
||||||
|
currentStep++;
|
||||||
|
//lastLastNode = lastNode;
|
||||||
|
//lastNode = nextNode;
|
||||||
|
nextNode = GetComponent<PathFinder>().Next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetComponent<PathFinder>().Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user