mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2025-07-18 19:41:54 +08:00
JSON fixes. Grids
This commit is contained in:
@ -301,6 +301,26 @@ namespace Strawberry
|
||||
return SceneHitbox.Intersects(rect);
|
||||
}
|
||||
|
||||
public bool Check(Scene scene)
|
||||
{
|
||||
return scene.SolidGrid != null && Check(scene.SolidGrid);
|
||||
}
|
||||
|
||||
public bool Check(Scene scene, Point offset)
|
||||
{
|
||||
return scene.SolidGrid != null && Check(scene.SolidGrid, offset);
|
||||
}
|
||||
|
||||
public bool Check(Grid grid)
|
||||
{
|
||||
return grid.Check(SceneHitbox);
|
||||
}
|
||||
|
||||
public bool Check(Grid grid, Point offset)
|
||||
{
|
||||
return grid.Check(SceneHitbox + offset);
|
||||
}
|
||||
|
||||
public bool Check(Entity other)
|
||||
{
|
||||
return other.Collidable && SceneHitbox.Intersects(other.SceneHitbox);
|
||||
|
@ -6,6 +6,7 @@ namespace Strawberry
|
||||
public class Scene
|
||||
{
|
||||
public float TimeStarted { get; private set; }
|
||||
public Grid SolidGrid;
|
||||
|
||||
private List<Entity> entities;
|
||||
private HashSet<Entity> toRemove;
|
||||
@ -20,6 +21,9 @@ namespace Strawberry
|
||||
|
||||
public ~this()
|
||||
{
|
||||
if (SolidGrid != null)
|
||||
delete SolidGrid;
|
||||
|
||||
for (var e in entities)
|
||||
if (e.DeleteOnRemove)
|
||||
delete e;
|
||||
|
Reference in New Issue
Block a user