Player Prefab changes
This commit is contained in:
@@ -4,11 +4,11 @@ using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using System;
|
||||
|
||||
public class Audiomanager : MonoBehaviour
|
||||
public class AudioManager : MonoBehaviour
|
||||
{
|
||||
public AudioSound[] clips;
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
public void Awake()
|
||||
{
|
||||
foreach (AudioSound c in clips)
|
||||
{
|
||||
@@ -20,7 +20,7 @@ public class Audiomanager : MonoBehaviour
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Play(string name)
|
||||
public void Play(string name)
|
||||
{
|
||||
AudioSound s = Array.Find(clips, sound => sound.name == name);
|
||||
s.source.Play();
|
||||
|
@@ -9,7 +9,7 @@ public class AudioSound
|
||||
|
||||
[Range(0f, 1f)]
|
||||
public float volume;
|
||||
[Range(.1f, 3f)]
|
||||
[Range(0.1f, 3f)]
|
||||
public float pitch;
|
||||
|
||||
[HideInInspector]
|
||||
|
@@ -57,6 +57,8 @@ public class PlayerManager : MonoBehaviour
|
||||
saveRunSpeed = runSpeed;
|
||||
saveJump = jump;
|
||||
saveSize = transform.localScale;
|
||||
|
||||
FindObjectOfType<AudioManager>().Play("MainTheme");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
Reference in New Issue
Block a user