using Godot; using GodotHostTest.Helpers; using GodotHostTest.Interfaces; using OwofGames.AetherBind; using R3; namespace GodotHostTest.Game.Score; public partial class Score : Control { [Export] private AnimationPlayer _animationPlayer = null!; [Inject] private ICurrentLevel _currentLevel = null!; [Export] private Label _label = null!; [Inject] private IScore _score = null!; public override void _Ready() { _score.Score.Subscribe(UpdateScore).AddTo(this); _score.Score.Chunk(2, 1).Where(values => values.Length == 2 && values[1] < values[0]) .Subscribe(OnScoreDecreasing).AddTo(this); } private void OnScoreDecreasing(T _) { _animationPlayer.Play("wiggle"); } private void UpdateScore(int newScore) { _label.Text = $"Level {_currentLevel.LevelNumber} - Score: {newScore}"; } }