WiP: deactivated array elements

This commit is contained in:
2024-11-03 14:56:07 +01:00
parent d1dac0b855
commit 383e1343ef
6 changed files with 52 additions and 31 deletions

View File

@@ -18,7 +18,7 @@ public class Element {
protected const float MAX_COLOR_VARIANCE = 0.1f;
protected static readonly Vector2I VERTICAL_OPPOSITE = new Vector2I(-1, 1);
private bool active = true;
private bool active = false;
private Color originalColor;
public Element(Element e) {
@@ -32,18 +32,17 @@ public class Element {
Position.Y = y;
Chunk = chunk;
LastMove = Engine.GetFramesDrawn();
Active = false;
}
public bool Active {
get => active;
set {
active = value;
Chunk.SetElementActive(this, active);
if (active == value) return;
if (active)
Color = originalColor;
else if (Main.Instance.DebugVisualization)
Color = new Color(0.2f, 0.2f, 0.2f);
active = value;
Chunk.SetElementActive(this, value);
SetDebugColors(value);
}
}
@@ -99,4 +98,11 @@ public class Element {
originalColor = c;
return c;
}
private void SetDebugColors(bool isActive) {
if (isActive)
Color = originalColor;
else if (Main.Instance.DebugVisualization)
Color = new Color(0.2f, 0.2f, 0.2f);
}
}