All Monsters now move
This commit is contained in:
@@ -89,7 +89,7 @@ namespace DepthsBelow.Component
|
||||
|
||||
public int Penalty(int distance)
|
||||
{
|
||||
return panic + GetPenalty(stepsTaken) + (int)(GetPenalty(distance) / 2);
|
||||
return panic/* + GetPenalty(stepsTaken)*/ + (int)(GetPenalty(distance));
|
||||
}
|
||||
|
||||
public Stat(Entity parent)
|
||||
|
||||
@@ -85,9 +85,9 @@ namespace DepthsBelow
|
||||
/// <param name="gameTime"></param>
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
foreach (var entity in Entities.ToList())
|
||||
entity.Update(gameTime);
|
||||
}
|
||||
foreach (var entity in Entities.ToList())
|
||||
entity.Update(gameTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw all entities handled by the entity manager.
|
||||
|
||||
@@ -146,9 +146,32 @@ namespace DepthsBelow
|
||||
|
||||
if (core.TurnManager.CurrentTurn == core.TurnManager["Computer"])
|
||||
{
|
||||
foreach (var enemy in core.Swarm)
|
||||
{
|
||||
enemy.step = 0;
|
||||
Point target = Point.Zero;
|
||||
float distance = 7000;
|
||||
foreach (var unit in core.Squad)
|
||||
{
|
||||
Vector2 soldier = new Vector2(unit.Transform.Grid.X, unit.Transform.Grid.Y);
|
||||
Vector2 monster = new Vector2(enemy.Transform.Grid.X, enemy.Transform.Grid.Y);
|
||||
|
||||
float newDistance = Vector2.Distance(soldier, monster);
|
||||
|
||||
if (newDistance < distance)
|
||||
{
|
||||
target = unit.Transform.Grid;
|
||||
distance = newDistance;
|
||||
}
|
||||
}
|
||||
enemy.GetComponent<Component.PathFinder>().Goal = target;
|
||||
distance = 7000;
|
||||
|
||||
}
|
||||
|
||||
core.TestMonster.step = 0;
|
||||
Point target = Point.Zero;
|
||||
float distance = 7000;
|
||||
Point testTarget = Point.Zero;
|
||||
float testDistance = 7000;
|
||||
foreach (var unit in core.Squad)
|
||||
{
|
||||
Vector2 soldier = new Vector2(unit.Transform.Grid.X, unit.Transform.Grid.Y);
|
||||
@@ -156,14 +179,14 @@ namespace DepthsBelow
|
||||
|
||||
float newDistance = Vector2.Distance(soldier, monster);
|
||||
|
||||
if (newDistance < distance)
|
||||
if (newDistance < testDistance)
|
||||
{
|
||||
target = unit.Transform.Grid;
|
||||
distance = newDistance;
|
||||
testTarget = unit.Transform.Grid;
|
||||
testDistance = newDistance;
|
||||
}
|
||||
}
|
||||
core.TestMonster.GetComponent<Component.PathFinder>().Goal = target;
|
||||
distance = 7000;
|
||||
core.TestMonster.GetComponent<Component.PathFinder>().Goal = testTarget;
|
||||
testDistance = 7000;
|
||||
|
||||
core.TurnManager.EndTurn();
|
||||
}
|
||||
|
||||
@@ -69,6 +69,17 @@ namespace DepthsBelow
|
||||
// HACK: Make this work properly with other speeds...
|
||||
float speed = 4f;
|
||||
Transform.World.Position += speed * direction;
|
||||
|
||||
foreach (var entity in entityManager.Entities)
|
||||
{
|
||||
if (entity is SmallEnemy)
|
||||
{
|
||||
if (this.GetComponent<Component.Collision>().Rectangle.Intersects(entity.GetComponent<Component.Collision>().Rectangle))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace DepthsBelow
|
||||
//Console.WriteLine(chanceToHit);
|
||||
return chanceToHit;
|
||||
}
|
||||
/*public static bool HitTest(Entity attacker, Entity defender, int chanceToHit)
|
||||
public static bool HitTest(Entity attacker, Entity defender, int chanceToHit)
|
||||
{
|
||||
Component.Stat shooting = attacker.GetComponent<Component.Stat>();
|
||||
Component.Stat dodging = defender.GetComponent<Component.Stat>();
|
||||
@@ -47,7 +47,7 @@ namespace DepthsBelow
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
private static Texture2D blank;
|
||||
|
||||
public static void DrawLine(SpriteBatch batch, Color color, float width, Vector2 start, Vector2 end)
|
||||
|
||||
Reference in New Issue
Block a user