using Godot; using System; using System.Collections.Generic; using System.Linq; public partial class Table : Sprite2D { [Signal] public delegate void OnBallPottedEventHandler(Ball THIS, Pocket POCKET); List _pockets; public override void _Ready() { _pockets = GetNode("Pockets") .GetChildren() .Select(n => (Pocket)n) .ToList(); for (int i = 0; i < _pockets.Count; i++) { _pockets[i].OnBallPotted += BallPotted; } } public void BallPotted(Node NODE, Pocket POCKET) { if (NODE is Ball) { EmitSignal(SignalName.OnBallPotted, (Ball)NODE, POCKET); } } }