using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Syntriax.Engine.Core; using Syntriax.Engine.Integration.MonoGame; namespace Pong.Behaviours; public class ScoreLabel(bool IsLeft) : Label, IFirstFrameUpdate, ILoadContent { public readonly bool IsLeft = IsLeft; private PongManager pongManager = null!; public void FirstActiveFrame() { pongManager = Universe.FindRequiredBehaviour(); pongManager.OnScoreUpdated += UpdateScores; pongManager.OnReset += UpdateScores; UpdateScores(pongManager); } public void LoadContent(ContentManager content) { Font = content.Load("UbuntuMono"); } private void UpdateScores(PongManager pongManager) { if (IsLeft) Text = pongManager.ScoreLeft.ToString(); else Text = pongManager.ScoreRight.ToString(); } }