fixed stuck rain
refactoring
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user