feat: start animation

This commit is contained in:
Gerard Gascón 2024-04-22 19:05:46 +02:00
parent a276096476
commit 3522a015f6
354 changed files with 22842 additions and 5 deletions

View file

@ -11,6 +11,7 @@ namespace View.Scene {
[SerializeField] private Animator animator;
[SerializeField] private Animation growAnimation;
[SerializeField] private Animation endAnimation;
[SerializeField] private Animation startAnimation;
[SerializeField] private EventReference growEvent;
[SerializeField] private EventReference gloomEvent;
@ -25,6 +26,8 @@ namespace View.Scene {
_score = FindObjectOfType<Dependencies>().Score;
_spawnRose = FindObjectOfType<Dependencies>().Spawner;
animator.PlayUntil(1f);
animator.OnAnimationEnd += AnimationEnded;
}
@ -37,8 +40,13 @@ namespace View.Scene {
}
if (animationName == "Rosa_End") {
Growing = true;
_spawnRose.Execute();
animator.ChangeAnimation(startAnimation);
animator.PlayUntil(1f);
}
if (animationName == "Rosa_Start") {
Growing = true;
animator.ChangeAnimation(growAnimation);
animator.PlayUntil(_score.GrowPercentage);
}