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