Entities with collision components can now be solid to the pathfinder.
This commit is contained in:
@@ -19,6 +19,11 @@ namespace DepthsBelow.Component
|
||||
/// </summary>
|
||||
public Rectangle Rectangle;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the entity is solid to other entities.
|
||||
/// </summary>
|
||||
public bool Solid = false;
|
||||
|
||||
/// <summary>
|
||||
/// Width of the collision rectangle.
|
||||
/// </summary>
|
||||
|
||||
@@ -153,6 +153,18 @@ namespace DepthsBelow.Component
|
||||
byte[,] mapCollisionMap = Core.Map.GetCollisionMap();
|
||||
|
||||
// Add solid collision component entities
|
||||
foreach (var collision in EntityManager.GetComponents<Collision>())
|
||||
{
|
||||
if (collision.Solid && collision.Parent != this.Parent)
|
||||
{
|
||||
try
|
||||
{
|
||||
var pos = collision.Parent.Position;
|
||||
mapCollisionMap[pos.X, pos.Y] = 0;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
if (appendCollisionMap != null)
|
||||
foreach (var point in appendCollisionMap)
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace DepthsBelow
|
||||
// TODO: OnClick events
|
||||
|
||||
// Tooltip stuff
|
||||
var tooltip = core.Lua.GetObject<GUI.Frame>("ToolTip");
|
||||
/*var tooltip = core.Lua.GetObject<GUI.Frame>("ToolTip");
|
||||
if (tooltip != null)
|
||||
{
|
||||
tooltip.Visible = false;
|
||||
@@ -189,7 +189,7 @@ namespace DepthsBelow
|
||||
tooltip.X = ms.X + 10;
|
||||
tooltip.Y = ms.Y + 15;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (core.TurnManager.CurrentTurn == core.TurnManager["Player"])
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace DepthsBelow
|
||||
AddComponent(rc);
|
||||
|
||||
var cc = new Collision(this, 32, 32);
|
||||
cc.Solid = true;
|
||||
AddComponent(cc);
|
||||
|
||||
var pfc = new PathFinder(this);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace DepthsBelow
|
||||
}
|
||||
|
||||
public int MaxActionPoints = 10;
|
||||
int actionPointsLeft = 0;
|
||||
int actionPointsLeft = 10;
|
||||
|
||||
public int AP
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user