Merge branch 'DO-65-승리-패널-나타나는-효과-배경-분리-필요' of https://github.com/Degulleo/DegullMok-Client into DO-65-승리-패널-나타나는-효과-배경-분리-필요
This commit is contained in:
commit
6d794dfa71
Assets
Resources
Sounds.meta
Sounds
Click Sound.mp3Click Sound.mp3.metaClose Sound.mp3Close Sound.mp3.metaCoins ADD Sound.wavCoins ADD Sound.wav.metaCoins Empty Sound.wavCoins Empty Sound.wav.metaCoins Remove Sound.wavCoins Remove Sound.wav.metaGame bgm2.mp3Game bgm2.mp3.metalose sound.mp3lose sound.mp3.metamain bgm.mp3main bgm.mp3.metastone sound 3.mp3stone sound 3.mp3.metawin sound.mp3win sound.mp3.meta
Script
8
Assets/Resources/Sounds.meta
Normal file
8
Assets/Resources/Sounds.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9fc9c29bf8c5aa040aaeace773096d1b
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
0
Assets/Resources/Coins_Remove_Sound.wav.meta → Assets/Resources/Sounds/Coins Remove Sound.wav.meta
0
Assets/Resources/Coins_Remove_Sound.wav.meta → Assets/Resources/Sounds/Coins Remove Sound.wav.meta
@ -1,21 +1,12 @@
|
|||||||
using UnityEngine;
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.Timeline;
|
using UnityEngine.Timeline;
|
||||||
|
|
||||||
public class AudioManager : Singleton<AudioManager>
|
public class AudioManager : Singleton<AudioManager>
|
||||||
{
|
{
|
||||||
[Header("BGM")]
|
private AudioClip mainBgm;
|
||||||
[SerializeField] private AudioClip mainBgm;
|
private AudioClip gameBgm;
|
||||||
[SerializeField] private AudioClip gameBgm;
|
|
||||||
[Header("SFX")]
|
|
||||||
[SerializeField] private AudioClip clickSound;
|
|
||||||
[SerializeField] private AudioClip closeSound;
|
|
||||||
[SerializeField] private AudioClip coinsAddSound;
|
|
||||||
[SerializeField] private AudioClip coinsEmptySound;
|
|
||||||
[SerializeField] private AudioClip coinsRemoveSound;
|
|
||||||
[SerializeField] private AudioClip winSound;
|
|
||||||
[SerializeField] private AudioClip loseSound;
|
|
||||||
[SerializeField] private AudioClip stoneSound;
|
|
||||||
|
|
||||||
[HideInInspector] public AudioSource bgmAudioSource; // BGM을 위한 AudioSource
|
[HideInInspector] public AudioSource bgmAudioSource; // BGM을 위한 AudioSource
|
||||||
private AudioSource sfxAudioSource; // SFX를 위한 AudioSource
|
private AudioSource sfxAudioSource; // SFX를 위한 AudioSource
|
||||||
@ -25,6 +16,9 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
[HideInInspector]public bool isPlayBGM;
|
[HideInInspector]public bool isPlayBGM;
|
||||||
[HideInInspector]public bool isPlaySFX;
|
[HideInInspector]public bool isPlaySFX;
|
||||||
|
|
||||||
|
private Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>();
|
||||||
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
base.Awake(); // 부모 클래스의 Awake 호출
|
base.Awake(); // 부모 클래스의 Awake 호출
|
||||||
@ -32,6 +26,30 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
// BGM과 SFX를 위한 별도의 AudioSource 생성
|
// BGM과 SFX를 위한 별도의 AudioSource 생성
|
||||||
bgmAudioSource = gameObject.AddComponent<AudioSource>();
|
bgmAudioSource = gameObject.AddComponent<AudioSource>();
|
||||||
sfxAudioSource = gameObject.AddComponent<AudioSource>();
|
sfxAudioSource = gameObject.AddComponent<AudioSource>();
|
||||||
|
|
||||||
|
//Sounds폴더 내의 모든 오디오클립 로드
|
||||||
|
AudioClip[] clips = Resources.LoadAll<AudioClip>("Sounds");
|
||||||
|
|
||||||
|
foreach (AudioClip clip in clips)
|
||||||
|
{
|
||||||
|
audioClips[clip.name] = clip;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug.Log($"총 {audioClips.Count}개의 오디오클립이 로드됨.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public AudioClip GetAudioClip(string clipName)
|
||||||
|
{
|
||||||
|
if (audioClips.TryGetValue(clipName, out AudioClip clip))
|
||||||
|
{
|
||||||
|
return clip;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError($"패널 '{clipName}'을 찾을 수 없습니다.");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 시작 시 BGM을 자동으로 재생
|
// 시작 시 BGM을 자동으로 재생
|
||||||
@ -39,12 +57,15 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
{
|
{
|
||||||
isPlayBGM = UserManager.IsPlayBGM;
|
isPlayBGM = UserManager.IsPlayBGM;
|
||||||
isPlaySFX = UserManager.IsPlaySFX;
|
isPlaySFX = UserManager.IsPlaySFX;
|
||||||
|
|
||||||
PlayBGM();
|
PlayBGM();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 메인 BGM을 재생하는 함수
|
// 메인 BGM을 재생하는 함수
|
||||||
public void PlayMainBGM()
|
public void PlayMainBGM()
|
||||||
{
|
{
|
||||||
|
mainBgm = GetAudioClip("main bgm");
|
||||||
|
|
||||||
if (bgmAudioSource != null && mainBgm != null && !bgmAudioSource.isPlaying)
|
if (bgmAudioSource != null && mainBgm != null && !bgmAudioSource.isPlaying)
|
||||||
{
|
{
|
||||||
bgmAudioSource.clip = mainBgm;
|
bgmAudioSource.clip = mainBgm;
|
||||||
@ -56,6 +77,8 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
|
|
||||||
public void PlayGameBGM()
|
public void PlayGameBGM()
|
||||||
{
|
{
|
||||||
|
gameBgm = GetAudioClip("Game bgm2");
|
||||||
|
|
||||||
if (bgmAudioSource != null && gameBgm != null && !bgmAudioSource.isPlaying)
|
if (bgmAudioSource != null && gameBgm != null && !bgmAudioSource.isPlaying)
|
||||||
{
|
{
|
||||||
bgmAudioSource.clip = gameBgm;
|
bgmAudioSource.clip = gameBgm;
|
||||||
@ -101,10 +124,9 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
// 클릭 사운드(SFX) 재생
|
// 클릭 사운드(SFX) 재생
|
||||||
public void PlayClickSound()
|
public void PlayClickSound()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isPlaySFX && sfxAudioSource != null)
|
if (isPlaySFX && sfxAudioSource != null)
|
||||||
{
|
{
|
||||||
sfxAudioSource.PlayOneShot(clickSound, sfxVolume);
|
sfxAudioSource.PlayOneShot(GetAudioClip("Click Sound"), sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +135,7 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
{
|
{
|
||||||
if (isPlaySFX && sfxAudioSource != null)
|
if (isPlaySFX && sfxAudioSource != null)
|
||||||
{
|
{
|
||||||
sfxAudioSource.PlayOneShot(closeSound, sfxVolume);
|
sfxAudioSource.PlayOneShot(GetAudioClip("Close Sound"), sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +143,7 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
{
|
{
|
||||||
if (isPlaySFX && sfxAudioSource!=null)
|
if (isPlaySFX && sfxAudioSource!=null)
|
||||||
{
|
{
|
||||||
sfxAudioSource.PlayOneShot(coinsAddSound, sfxVolume);
|
sfxAudioSource.PlayOneShot(GetAudioClip("Coins ADD Sound"), sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +151,7 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
{
|
{
|
||||||
if (isPlaySFX && sfxAudioSource!=null)
|
if (isPlaySFX && sfxAudioSource!=null)
|
||||||
{
|
{
|
||||||
sfxAudioSource.PlayOneShot(coinsEmptySound, sfxVolume);
|
sfxAudioSource.PlayOneShot(GetAudioClip("Coins Empty Sound"), sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +159,7 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
{
|
{
|
||||||
if (isPlaySFX && sfxAudioSource!=null)
|
if (isPlaySFX && sfxAudioSource!=null)
|
||||||
{
|
{
|
||||||
sfxAudioSource.PlayOneShot(coinsRemoveSound, sfxVolume);
|
sfxAudioSource.PlayOneShot(GetAudioClip("Coins Remove Sound"), sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +167,7 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
{
|
{
|
||||||
if (isPlaySFX && sfxAudioSource!=null)
|
if (isPlaySFX && sfxAudioSource!=null)
|
||||||
{
|
{
|
||||||
sfxAudioSource.PlayOneShot(loseSound, sfxVolume);
|
sfxAudioSource.PlayOneShot(GetAudioClip("lose sound"), sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +175,7 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
{
|
{
|
||||||
if (isPlaySFX && sfxAudioSource!=null)
|
if (isPlaySFX && sfxAudioSource!=null)
|
||||||
{
|
{
|
||||||
sfxAudioSource.PlayOneShot(winSound, sfxVolume);
|
sfxAudioSource.PlayOneShot(GetAudioClip("win sound"), sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +183,7 @@ public class AudioManager : Singleton<AudioManager>
|
|||||||
{
|
{
|
||||||
if (isPlaySFX && sfxAudioSource!=null)
|
if (isPlaySFX && sfxAudioSource!=null)
|
||||||
{
|
{
|
||||||
sfxAudioSource.PlayOneShot(stoneSound, sfxVolume);
|
sfxAudioSource.PlayOneShot(GetAudioClip("stone sound3"), sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -53,7 +53,7 @@ public class CoinsPanelController : MonoBehaviour
|
|||||||
_coinsRect.sizeDelta = new Vector2(100 + textLength * 30f, 100f);
|
_coinsRect.sizeDelta = new Vector2(100 + textLength * 30f, 100f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeTextAnimation(bool isAdd, Action action)
|
private void ChangeTextAnimation(int coinAdd, bool isAdd, Action action)
|
||||||
{
|
{
|
||||||
float duration = 0.2f;
|
float duration = 0.2f;
|
||||||
float yPos = 40f;
|
float yPos = 40f;
|
||||||
@ -64,8 +64,8 @@ public class CoinsPanelController : MonoBehaviour
|
|||||||
if (isAdd)
|
if (isAdd)
|
||||||
{
|
{
|
||||||
var currentHeartCount = coinsCountText.text;
|
var currentHeartCount = coinsCountText.text;
|
||||||
coinsCountText.text = (int.Parse(currentHeartCount) + 500).ToString();
|
coinsCountText.text = (int.Parse(currentHeartCount) + coinAdd).ToString();
|
||||||
// 코인 텍스트 100씩 증가
|
// 코인 텍스트 증가
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -98,14 +98,11 @@ public class CoinsPanelController : MonoBehaviour
|
|||||||
_canvasGroup.blocksRaycasts = false; //코인 중복 추가 방지 코드
|
_canvasGroup.blocksRaycasts = false; //코인 중복 추가 방지 코드
|
||||||
|
|
||||||
Sequence sequence = DOTween.Sequence();
|
Sequence sequence = DOTween.Sequence();
|
||||||
// i += a 반복 횟수 조절, 100개 단위로 상승 차감 시 100으로 설정
|
|
||||||
for (int i = 0; i < coinsCount; i+=500)
|
|
||||||
{
|
|
||||||
sequence.AppendCallback(() =>
|
sequence.AppendCallback(() =>
|
||||||
{
|
{
|
||||||
ChangeTextAnimation(true, ()=>
|
ChangeTextAnimation(coinsCount,true, ()=>
|
||||||
{
|
{
|
||||||
_coinsCount += 500;
|
_coinsCount += coinsCount;
|
||||||
action?.Invoke();
|
action?.Invoke();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -113,7 +110,7 @@ public class CoinsPanelController : MonoBehaviour
|
|||||||
AudioManager.Instance.PlayCoinsAddSound();
|
AudioManager.Instance.PlayCoinsAddSound();
|
||||||
});
|
});
|
||||||
sequence.AppendInterval(0.5f);
|
sequence.AppendInterval(0.5f);
|
||||||
}
|
|
||||||
sequence.OnComplete(() =>
|
sequence.OnComplete(() =>
|
||||||
{
|
{
|
||||||
_canvasGroup.blocksRaycasts = true; //구매 후 클릭 활성화
|
_canvasGroup.blocksRaycasts = true; //구매 후 클릭 활성화
|
||||||
@ -152,7 +149,7 @@ public class CoinsPanelController : MonoBehaviour
|
|||||||
|
|
||||||
coinsRemoveImageObject.transform.DOScale(3f, 1f);
|
coinsRemoveImageObject.transform.DOScale(3f, 1f);
|
||||||
coinsRemoveImageObject.GetComponent<Image>().DOFade(0f, 1f)
|
coinsRemoveImageObject.GetComponent<Image>().DOFade(0f, 1f)
|
||||||
.OnComplete( ()=>ChangeTextAnimation(false, ()=>
|
.OnComplete( ()=>ChangeTextAnimation(0,false, ()=>
|
||||||
{
|
{
|
||||||
//감소된 코인 적용
|
//감소된 코인 적용
|
||||||
_coinsCount -= 100;
|
_coinsCount -= 100;
|
||||||
|
@ -264,7 +264,7 @@ public class PanelManager : MonoBehaviour
|
|||||||
shopItems.Add(shopItem);
|
shopItems.Add(shopItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GameManager.Instance.panelManager.OpenShopPanel(shopItems);
|
OpenShopPanel(shopItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
//승급 패널 생성
|
//승급 패널 생성
|
||||||
|
Loading…
x
Reference in New Issue
Block a user