public void recycleRaindrop(Raindrop raindrop) { if (raindrop.GetParent() == this) { CallDeferred("remove_child", raindrop); } //RemoveChild(raindrop); raindrop.SetPhysicsProcess(false); raindrop.Visible = false; _drop_q.Enqueue(raindrop); }
public override void _PhysicsProcess(float delta) { if (add_next != null && add_next.GetParent() == null && GetChildCount() < MAX_DROPS) { add_next.Position = new Vector2((float)random.NextDouble() * GDKnyttAssetManager.TILE_WIDTH, 12f); add_next.max_distance = (KnyttArea.AREA_HEIGHT - Coords.y) * GDKnyttAssetManager.TILE_HEIGHT; add_next.reset(this); CallDeferred("add_child", add_next); add_next = null; } if (add_next == null && ((float)random.NextDouble()) * .4f < delta) { add_next = nextRaindrop(); } }