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

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6e69d813584e486485ead64a8a789500
timeCreated: 1713475813

View file

@ -1,6 +1,6 @@
using Presenter;
namespace View {
namespace View.Collections {
public class ExpressionInputCollection : IExpressionInput {
private readonly IExpressionInput[] _inputs;

View file

@ -0,0 +1,21 @@
using Presenter;
namespace View.Collections {
public class RoseGrowCollection : IRoseGrow {
private readonly IRoseGrow[] _grows;
public RoseGrowCollection(IRoseGrow[] grows) {
_grows = grows;
}
public void Grow() {
foreach (IRoseGrow grow in _grows)
grow.Grow();
}
public void GrowStep() {
foreach (IRoseGrow grow in _grows)
grow.GrowStep();
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6f517298528d4766a83770b1867f905f
timeCreated: 1713475808

View file

@ -3,6 +3,7 @@ using Domain;
using Presenter;
using Presenter.SaveSystem;
using UnityEngine;
using View.Collections;
using View.Scene;
using View.UI;
@ -25,8 +26,10 @@ namespace View {
IRoseSpawner spawner = FindObjectOfType<RoseSpawner>();
IRoseGrow grow = FindObjectOfType<GrowParticlesSpawner>();
IRoseGrow inputGrow = FindObjectOfType<ExpressionInput>();
IRoseGrow growCollection = new RoseGrowCollection(new[] { grow, inputGrow });
ExpressionClick = new ExpressionClick(Score, inputCollections, spawner, grow);
ExpressionClick = new ExpressionClick(Score, inputCollections, spawner, growCollection);
CustomInput = new CustomInput();

View file

@ -14,6 +14,8 @@ namespace View.Scene {
Instantiate(growParticle, growParticlePositions.position, Quaternion.Euler(0f, 0f, randomRotation));
}
public void GrowStep() { }
private void OnDrawGizmosSelected() {
Gizmos.color = Color.red;
float angle = angleRange / 2f + 90f;

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;

View file

@ -44,8 +44,8 @@ namespace View.UI {
AppWindowUtility.AlwaysOnTop = state;
}
private void SFXStateChange(bool state) => _sfxBus.setMute(state);
private void MusicStateChange(bool state) => _musicBus.setMute(state);
private void SFXStateChange(bool state) => _sfxBus.setMute(!state);
private void MusicStateChange(bool state) => _musicBus.setMute(!state);
private void OpenSettings() {
mainUIGroup.interactable = mainUIGroup.blocksRaycasts = false;