feat: new sounds

This commit is contained in:
Gerard Gascón 2024-04-19 00:10:29 +02:00
parent 60265f3417
commit cbc95ec2d3
20 changed files with 302 additions and 19 deletions

View file

@ -1,5 +1,6 @@
using Domain;
using Domain.Input;
using FMODUnity;
using Presenter;
using TMPro;
using UnityEngine;
@ -8,7 +9,7 @@ using Animation = FramedAnimator.Animation;
using Animator = FramedAnimator.Animator;
namespace View.UI {
public class ExpressionInput : MonoBehaviour, IExpressionInput {
public class ExpressionInput : MonoBehaviour, IExpressionInput, IRoseGrow {
[SerializeField] private TMP_Text text;
private ExpressionClick _click;
@ -21,6 +22,9 @@ namespace View.UI {
[SerializeField] private Animation growAnimation;
[SerializeField] private Animation endAnimation;
[SerializeField] private EventReference growEvent;
[SerializeField] private EventReference gloomEvent;
private void Start() {
_click = FindObjectOfType<Dependencies>().ExpressionClick;
_customInput = FindObjectOfType<Dependencies>().CustomInput;
@ -32,6 +36,7 @@ namespace View.UI {
private void AnimationEnded(string animationName) {
if (animationName == "Rosa_Grow") {
animator.ChangeAnimation(endAnimation);
RuntimeManager.PlayOneShot(gloomEvent);
animator.PlayUntil(1f);
return;
}
@ -54,6 +59,13 @@ namespace View.UI {
_firstUpdate = false;
}
public void Grow() { }
public void GrowStep() {
if (animator.CurrentAnimation == "Rosa_Grow" && _score.GrowPercentage < 1f) {
RuntimeManager.PlayOneShot(growEvent);
}
}
private bool IsLastGrowState(int score, float growPercentage) {
if (growPercentage != 0)
return false;