fixed stuck rain

refactoring
This commit is contained in:
2025-04-30 23:13:53 +02:00
parent d9bde10c3c
commit 0b97027e00
4 changed files with 21 additions and 6 deletions

View File

@@ -32,8 +32,7 @@ public class Element{
Position.X = x;
Position.Y = y;
Chunk = chunk;
lastMove = Engine.GetFramesDrawn();
Active = false;
Active = true;
}
public bool Active {
@@ -43,6 +42,8 @@ public class Element{
active = value;
Chunk.SetElementActive(this, value);
lastMove = Engine.GetFramesDrawn();
if (!active)
ResetColor();
else
@@ -93,6 +94,7 @@ public class Element{
Chunk.Swap(this, Position + Vector2I.Down);
}
/// <returns>-1, 0 or 1</returns>
protected Vector2I RandomDirectionDown() {
int randomDirection = GD.Randi() % 2 != 0 ? 1 : -1;
@@ -133,4 +135,8 @@ public class Element{
public void MarkForUpdate(bool mark = true) {
markedForUpdate = true;
}
public bool IsEmpty() {
return GetType() == typeof(Element);
}
}