using Godot; using System.Collections; using System.Collections.Generic; using Godot.Collections; namespace Rokojori { [GlobalClass,Tool] public partial class Hitable:Node { [Export] public OnCollision onCollision; [Export] public Action onReceivedHit; public override void _Ready() { onCollision.onEnteredSlot.AddAction( ( n )=> { Action.Trigger( onReceivedHit ); var hitter = n.Get(); this.LogInfo( "Was hit by:", n, hitter ); if ( hitter != null ) { hitter.hitable = this; Action.Trigger( hitter.onHit ); hitter.hitable = null; } } ); } } }