chore: updated engine
This commit is contained in:
19
Shared/Behaviours/WallScoreBehaviour.cs
Normal file
19
Shared/Behaviours/WallScoreBehaviour.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
using Syntriax.Engine.Core;
|
||||
using Syntriax.Engine.Physics2D.Abstract;
|
||||
|
||||
namespace Pong.Behaviours;
|
||||
|
||||
public class WallScoreBehaviour(Action OnCollision) : Behaviour2D
|
||||
{
|
||||
private Action OnCollision { get; } = OnCollision;
|
||||
|
||||
protected override void OnFirstActiveFrame()
|
||||
{
|
||||
if (!BehaviourController.TryGetBehaviour(out ICollider2D? collider2D))
|
||||
return;
|
||||
|
||||
collider2D.OnCollisionDetected += (_, _1) => OnCollision?.Invoke();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user