fix: first clicks now are properly detected

This commit is contained in:
Gerard Gascón 2024-04-20 12:22:05 +02:00
parent db839ea96d
commit 2cddb7a7b9
13 changed files with 99 additions and 30 deletions

View file

@ -16,7 +16,7 @@ namespace View.Scene {
[SerializeField] private EventReference gloomEvent;
private Score _score;
private bool _firstUpdate;
private bool _firstUpdate = true;
private void Start() {
_score = FindObjectOfType<Dependencies>().Score;
@ -41,7 +41,7 @@ namespace View.Scene {
public void GrowStep() {
if (animator.CurrentAnimation == "Rosa_Grow") {
animator.PlayUntil(IsLastGrowState(_score.Value, _score.GrowPercentage) ? 1f : _score.GrowPercentage);
if (_score.GrowPercentage < 1f)
if (_score.GrowPercentage < 1f && !_firstUpdate)
RuntimeManager.PlayOneShot(growEvent);
}
_firstUpdate = false;