public void UpdateStep() { if (World.gameTicks % 10 != 0) { return; } var burn = World.entities[Position].Where(e => !ReferenceEquals(e, this)).OfType <Damageable>().FirstOrDefault(); if (burn != null) { burn.OnDamaged(this); } var below = Position.PlusZ(-1); if (World.voxels.InBounds(below) && World.voxels[below] is Grass g) { Func <int, int, int> rnd = World.karma.NextInteger; int r = rnd(0, 400); if (r == 0) { World.voxels[below] = new Dirt(); Active = false; } else if (r == 1) { var adjacent = new XY[] { new XY(-1, 0), new XY(1, 0), new XY(0, -1), new XY(0, 1) } .Select(p => Position + p) .Where(p => World.voxels.InBounds(p)) .Where(p => World.voxels[p.PlusZ(-1)] is Grass g) .Where(p => !World.entities[p].OfType <Fire>().Any()); if (adjacent.Any()) { var p = adjacent.ElementAt(rnd(0, adjacent.Count())); World.AddEntity(new Fire(World) { Position = p }); } } } else { Active = false; } }