Update to Beef 0.24.4

This commit is contained in:
Matt Thorson 2020-05-20 11:46:25 -07:00
parent 17fc10eb7c
commit 59a2eaaed6
5 changed files with 42 additions and 25 deletions

View File

@ -338,7 +338,7 @@ namespace Strawberry
public bool Check<T>() where T : Entity public bool Check<T>() where T : Entity
{ {
for (var e in Scene.All<T>(scope List<T>)) for (var e in Scene.All<T>(scope List<T>()))
if (Check(e)) if (Check(e))
return true; return true;
@ -347,7 +347,7 @@ namespace Strawberry
public bool Check<T>(Point offset) where T : Entity public bool Check<T>(Point offset) where T : Entity
{ {
for (var e in Scene.All<T>(scope List<T>)) for (var e in Scene.All<T>(scope List<T>()))
if (Check(e, offset)) if (Check(e, offset))
return true; return true;
@ -356,7 +356,7 @@ namespace Strawberry
public bool CheckOutside<T>(Point offset) where T : Entity public bool CheckOutside<T>(Point offset) where T : Entity
{ {
for (var e in Scene.All<T>(scope List<T>)) for (var e in Scene.All<T>(scope List<T>()))
if (CheckOutside(e, offset)) if (CheckOutside(e, offset))
return true; return true;
@ -365,7 +365,7 @@ namespace Strawberry
public T First<T>() where T : Entity public T First<T>() where T : Entity
{ {
for (var e in Scene.All<T>(scope List<T>)) for (var e in Scene.All<T>(scope List<T>()))
if (Check(e)) if (Check(e))
return e; return e;
@ -374,7 +374,7 @@ namespace Strawberry
public T First<T>(Point offset) where T : Entity public T First<T>(Point offset) where T : Entity
{ {
for (var e in Scene.All<T>(scope List<T>)) for (var e in Scene.All<T>(scope List<T>()))
if (Check(e, offset)) if (Check(e, offset))
return e; return e;
@ -383,7 +383,7 @@ namespace Strawberry
public T FirstOutside<T>(Point offset) where T : Entity public T FirstOutside<T>(Point offset) where T : Entity
{ {
for (var e in Scene.All<T>(scope List<T>)) for (var e in Scene.All<T>(scope List<T>()))
if (CheckOutside(e, offset)) if (CheckOutside(e, offset))
return e; return e;
@ -392,7 +392,7 @@ namespace Strawberry
public List<T> All<T>(List<T> into) where T : Entity public List<T> All<T>(List<T> into) where T : Entity
{ {
for (var e in Scene.All<T>(scope List<T>)) for (var e in Scene.All<T>(scope List<T>()))
if (Check(e)) if (Check(e))
into.Add(e); into.Add(e);
@ -401,7 +401,7 @@ namespace Strawberry
public List<T> All<T>(Point offset, List<T> into) where T : Entity public List<T> All<T>(Point offset, List<T> into) where T : Entity
{ {
for (var e in Scene.All<T>(scope List<T>)) for (var e in Scene.All<T>(scope List<T>()))
if (Check(e, offset)) if (Check(e, offset))
into.Add(e); into.Add(e);
@ -410,7 +410,7 @@ namespace Strawberry
public List<T> AllOutside<T>(Point offset, List<T> into) where T : Entity public List<T> AllOutside<T>(Point offset, List<T> into) where T : Entity
{ {
for (var e in Scene.All<T>(scope List<T>)) for (var e in Scene.All<T>(scope List<T>()))
if (CheckOutside(e, offset)) if (CheckOutside(e, offset))
into.Add(e); into.Add(e);

View File

@ -43,7 +43,7 @@ namespace Strawberry
MovedByGeometry = Point.Zero; MovedByGeometry = Point.Zero;
} }
public bool MoveX(float amount, Action<Collision> onCollide = null) public bool MoveX(float amount, delegate void(Collision) onCollide = null)
{ {
remainder.X += amount; remainder.X += amount;
let move = (int)Math.Round(remainder.X); let move = (int)Math.Round(remainder.X);
@ -56,7 +56,7 @@ namespace Strawberry
return false; return false;
} }
public bool MoveY(float amount, Action<Collision> onCollide = null) public bool MoveY(float amount, delegate void(Collision) onCollide = null)
{ {
remainder.Y += amount; remainder.Y += amount;
let move = (int)Math.Round(remainder.Y); let move = (int)Math.Round(remainder.Y);
@ -72,16 +72,16 @@ namespace Strawberry
[Inline] [Inline]
public void MoveToX(float x) public void MoveToX(float x)
{ {
MoveX(x - (X + remainder.X)); MoveX(x - (X + remainder.X), null);
} }
[Inline] [Inline]
public void MoveToY(float y) public void MoveToY(float y)
{ {
MoveY(y - (Y + remainder.Y)); MoveY(y - (Y + remainder.Y), null);
} }
public bool MoveExactX(int amount, Action<Collision> onCollide = null, Geometry pusher = null, Geometry carrier = null) public bool MoveExactX(int amount, delegate void(Collision) onCollide = null, Geometry pusher = null, Geometry carrier = null)
{ {
int move = amount; int move = amount;
int sign = Math.Sign(amount); int sign = Math.Sign(amount);
@ -127,7 +127,7 @@ namespace Strawberry
return false; return false;
} }
public bool MoveExactY(int amount, Action<Collision> onCollide = null, Geometry pusher = null, Geometry carrier = null) public bool MoveExactY(int amount, delegate void(Collision) onCollide = null, Geometry pusher = null, Geometry carrier = null)
{ {
int move = amount; int move = amount;
int sign = Math.Sign(amount); int sign = Math.Sign(amount);
@ -195,5 +195,22 @@ namespace Strawberry
{ {
MovedByGeometry += amount; MovedByGeometry += amount;
} }
public bool CornerCorrection(Cardinals direction, int maxAmount, int lookAhead = 1, int onlySign = 0)
{
Point pt = direction;
if (pt.X != 0)
{
}
else
{
}
return false;
}
} }
} }

View File

@ -20,7 +20,7 @@ namespace Strawberry
{ {
if (Collidable) if (Collidable)
{ {
let riders = GetRiders(scope List<Actor>); let riders = GetRiders(scope List<Actor>());
X += amount; X += amount;
for (var a in riders) for (var a in riders)
@ -34,11 +34,11 @@ namespace Strawberry
{ {
if (Collidable) if (Collidable)
{ {
let riders = GetRiders(scope List<Actor>); let riders = GetRiders(scope List<Actor>());
if (amount < 0) if (amount < 0)
{ {
for (var a in Scene.All<Actor>(scope List<Actor>)) for (var a in Scene.All<Actor>(scope List<Actor>()))
{ {
if (riders.Contains(a) || CheckOutside(a, Point.UnitY * amount)) if (riders.Contains(a) || CheckOutside(a, Point.UnitY * amount))
{ {
@ -65,7 +65,7 @@ namespace Strawberry
public override List<Actor> GetRiders(List<Actor> into) public override List<Actor> GetRiders(List<Actor> into)
{ {
for (var a in Scene.All<Actor>(scope List<Actor>)) for (var a in Scene.All<Actor>(scope List<Actor>()))
if (a.IsRiding(this)) if (a.IsRiding(this))
into.Add(a); into.Add(a);
return into; return into;

View File

@ -12,7 +12,7 @@ namespace Strawberry
public override List<Actor> GetRiders(List<Actor> into) public override List<Actor> GetRiders(List<Actor> into)
{ {
for (var a in Scene.All<Actor>(scope List<Actor>)) for (var a in Scene.All<Actor>(scope List<Actor>()))
if (a.IsRiding(this)) if (a.IsRiding(this))
into.Add(a); into.Add(a);
return into; return into;
@ -22,12 +22,12 @@ namespace Strawberry
{ {
if (Collidable) if (Collidable)
{ {
let riders = GetRiders(scope List<Actor>); let riders = GetRiders(scope List<Actor>());
X += amount; X += amount;
Collidable = false; Collidable = false;
for (Actor a in Scene.All<Actor>(scope List<Actor>)) for (Actor a in Scene.All<Actor>(scope List<Actor>()))
{ {
if (Check(a)) if (Check(a))
{ {
@ -56,12 +56,12 @@ namespace Strawberry
{ {
if (Collidable) if (Collidable)
{ {
let riders = GetRiders(scope List<Actor>); let riders = GetRiders(scope List<Actor>());
Y += amount; Y += amount;
Collidable = false; Collidable = false;
for (Actor a in Scene.All<Actor>(scope List<Actor>)) for (Actor a in Scene.All<Actor>(scope List<Actor>()))
{ {
if (Check(a)) if (Check(a))
{ {

View File

@ -49,7 +49,7 @@ namespace Strawberry
[Inline] [Inline]
static public void Log<T>(T v) static public void Log<T>(T v)
{ {
String string = scope String; String string = scope String();
v.ToString(string); v.ToString(string);
Debug.WriteLine(string); Debug.WriteLine(string);
} }