Add Alot of stuff, Computer, repairStation, Whole game, Many things!
This commit is contained in:
46
Assets/SoundFXController.cs
Normal file
46
Assets/SoundFXController.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SoundFXController : MonoBehaviour
|
||||
{
|
||||
public static SoundFXController Instance { get; private set; }
|
||||
|
||||
[SerializeField] private Transform _audioDestination;
|
||||
|
||||
[SerializeField] private AudioClip _itemBoughtClip;
|
||||
[SerializeField] private AudioClip _ovenDoneClip;
|
||||
[SerializeField] private AudioClip _villagerHappyClip;
|
||||
[SerializeField] private AudioClip _villagerAngryClip;
|
||||
|
||||
private void Awake() {
|
||||
if (Instance != null) {
|
||||
Debug.LogError("What? 2 SoundFXController crazy!!!");
|
||||
}
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
|
||||
public void PlayItemBoughtFX() {
|
||||
AudioSource.PlayClipAtPoint(_itemBoughtClip, _audioDestination.position);
|
||||
}
|
||||
|
||||
public void PlayOvenDoneFX() {
|
||||
float volume = 0.5f;
|
||||
AudioSource.PlayClipAtPoint(_ovenDoneClip, _audioDestination.position, volume);
|
||||
}
|
||||
|
||||
public void PlayVillagerHappyFX() {
|
||||
AudioSource.PlayClipAtPoint(_villagerHappyClip, _audioDestination.position);
|
||||
}
|
||||
|
||||
public void PlayVillagerAngryFX() {
|
||||
AudioSource.PlayClipAtPoint(_villagerAngryClip, _audioDestination.position);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user