added color variance

This commit is contained in:
2023-10-17 14:33:21 +02:00
parent 31dbbbf070
commit 43d121d4da
4 changed files with 18 additions and 14 deletions

View File

@@ -11,18 +11,18 @@ public abstract class Liquid : Element {
Vector2I freePos = Vector2I.Zero;
for (int y = 0; y <= maxDirection.Y; y++) { // height
if (source.Position.Y + y >= _level.SizeY) return freePos; // bounds check
if (source.Position.Y + y >= Level.SizeY) return freePos; // bounds check
if (_level.Get(source.Position.X, source.Position.Y + y).GetType() == typeof(Element)) {
if (Level.Get(source.Position.X, source.Position.Y + y).GetType() == typeof(Element)) {
freePos = new Vector2I(source.Position.X, source.Position.Y + y);
}
for (int x = -maxDirection.X; x <= maxDirection.X; x++) { // width
if (freePos != Vector2I.Zero) break;
if (source.Position.X + x >= _level.SizeX || source.Position.X + x < 0) return freePos; // bounds check
if (source.Position.X + x >= Level.SizeX || source.Position.X + x < 0) return freePos; // bounds check
if (_level.Get(source.Position.X + x, source.Position.Y + y).GetType() == typeof(Element)) {
if (Level.Get(source.Position.X + x, source.Position.Y + y).GetType() == typeof(Element)) {
freePos = new Vector2I(source.Position.X + x, source.Position.Y + y);
break;
}