일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- stride
- DSP
- MAC
- 게임개발
- animation
- 운영체제
- MLFQ
- CTF
- photon fusion2
- Multiplay
- 유니티
- 유스케이스
- Race condition
- gameplay ability system
- Unreal Engine
- DP
- ret2libc
- 메카님
- ability task
- boss monster
- Security
- unity
- 언리얼 엔진
- Delegate
- dirty cow
- 게임 개발
- Rr
- 언리얼엔진
- gas
- Replication
Archives
- Today
- Total
다양한 기록
[Fortress Craft] Sound, FxSound 본문
효과음은 애셋 쓰고, 배경음은 AI로 만들었음
1. FxSound
public void Attack()
{
if (attackInputTimer.Expired(Runner) && animState.fullPathHash != animAttack )
{
if (Job == JobType.Archer)
{
archerFire.FireDirection = lastDir;
archerFire.SetDamageByLevel(level, Job);
if (!BuffAttackTimer.Expired(Runner))
{
archerFire.BuffDamage(coefAttack);
}
Invoke("PlaySound1", 0.4f);
}
else if (Job == JobType.Magician)
{
magicianFire.SetDamageByLevel(level, Job);
if( !BuffAttackTimer.Expired(Runner) )
{
magicianFire.BuffDamage(coefAttack);
}
Invoke("PlaySound1", 0.3f);
}
else if( Job == JobType.Warrior)
{
SetAttack(level, Job);
wairrorWeapon.Damage = AttackDamage;
if( !BuffAttackTimer.Expired(Runner) )
{
wairrorWeapon.Damage *= coefAttack;
}
Invoke("PlaySound1", 0.2f);
}
_netAnimator.Animator.SetTrigger("Attack");
attackInputTimer = TickTimer.CreateFromSeconds(Runner, 0.2f);
}
}
public void PlaySound1()
{
sound1.volume = SoundManager.Instance.SFXVolume;
sound1.Play();
}
이벤트()에 Sound를 달아줌
그리고 틀 때는 SoundManager에서 소리를 가져옴
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Agit.FortressCraft
{
public class SoundManager : MonoBehaviour
{
[SerializeField] private GameObject BGM_Main;
public static SoundManager Instance { get; set; }
public float BGMVolume { get; set; }
public float SFXVolume { get; set; }
private void Awake()
{
Instance = this;
BGMVolume = 1.0f;
SFXVolume = 1.0f;
}
public void UpdateBGMVolume()
{
BGM bgm = GameObject.Find("BGM").GetComponent<BGM>();
bgm.SetVolume(BGMVolume);
}
}
}
SoundManager
2. BGM
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Agit.FortressCraft
{
public class BGM : MonoBehaviour
{
private AudioSource bgm = null;
private void Awake()
{
bgm = GetComponent<AudioSource>();
}
private void Start()
{
bgm.volume = SoundManager.Instance.BGMVolume;
}
public void SetVolume(float volume)
{
if (bgm == null) return;
bgm.volume = volume;
}
}
}
Photon 특징: 씬 이동해도 이전 씬 안없어짐
이번 프로젝트에선 씬 두개가 동시에 유지되는 형태임 (맨 처음 씬이 계속 유지됨)
=> 그냥 배경 음악 넣어두고 씬 넘어가면 알아서 삭제되겠지 불가능
public void Start() // UI Changer Call
{
currentSceneName = gameObject.name;
if (gameObject.name == "Lobby" || gameObject.name == "TeamLobby")
{
if (FindObjectOfType<App>().mode == Mode.Team){
_setTeamGroup.SetActive(true);
}
else
{
_singleModeMap.SetActive(true);
}
if (gameObject.name == "TeamLobby")
{
}
Instantiate(BGM_Lobby).gameObject.name = "BGM";
}
if (gameObject.name == "Battle")
{
FindObjectOfType<UIManager>().LoadingMsg.SetActive(false);
GameObject bgm = FindObjectOfType<BGM>().gameObject;
if (bgm != null)
Destroy(FindObjectOfType<BGM>().gameObject);
Instantiate(BGM_Battle).gameObject.name = "BGM";
FindObjectOfType<LevelUIController>().BattleSceneUIChange();
Invoke("SpawnCastle", 2f);
}
if (gameObject.name == "RPG")
{
FindObjectOfType<LevelUIController>().RPGSceneUIChange();
}
}
맵에 따라 BGM 삭제 및 생성이 필요 함
그리고 BGM 업데이트 시 UpdateVolume Call 하도록 슬라이더에 연결
'유니티 엔진 > Fortress Craft' 카테고리의 다른 글
[Fortress Craft] 성장의 가호 (증강 시스템) (0) | 2025.02.06 |
---|---|
[Fortress Craft] ** Request Authority When Master Client Connection Exit ** / Monster Spawner (0) | 2025.02.06 |
[Fortress Craft] Unit Upgrade (공격) (0) | 2025.02.06 |
[Fortress Craft] 맵 확장 (0) | 2025.02.06 |
[Fortress Craft] Normal Monster With Scriptable Object (0) | 2025.02.06 |