fixed inactive elements when spawning with brush

This commit is contained in:
2024-08-25 19:03:40 +02:00
parent 2d38774341
commit 7388e1a2d7
5 changed files with 16 additions and 17 deletions

View File

@@ -13,7 +13,7 @@ public class Element {
public int DiffuseSpeed = 10;
public const int MAX_DIFFUSE_SPEED = 100;
public const int STEPS_UNTIL_INACTIVE = 100;
public const int STEPS_UNTIL_INACTIVE = 500;
protected const float MAX_COLOR_VARIANCE = 0.1f;
protected static readonly Vector2I VERTICAL_OPPOSITE = new Vector2I(-1, 1);
@@ -24,12 +24,14 @@ public class Element {
public Element(Element e) {
Position = e.Position;
Chunk = e.Chunk;
LastMove = Engine.GetFramesDrawn();
}
public Element(int x, int y, Chunk chunk) {
Position.X = x;
Position.Y = y;
Chunk = chunk;
LastMove = Engine.GetFramesDrawn();
}
public bool Active {
@@ -49,11 +51,11 @@ public class Element {
/// </summary>
/// <param name="currentFrame"></param>
/// <returns>false if there is nothing to do</returns>
public virtual bool Update(int currentFrame) {
public virtual bool Update() {
if (!Active) return false;
if (LastUpdate == currentFrame) return false; // already updated this frame
LastUpdate = currentFrame;
if (LastUpdate == Engine.GetFramesDrawn()) return false; // already updated this frame
LastUpdate = Engine.GetFramesDrawn();
return true;
}