Player Prefab changes

This commit is contained in:
GamerClassN7
2021-01-31 11:58:07 +01:00
parent 37e93d3ea9
commit 42ec46d32b
4 changed files with 58 additions and 35 deletions

View File

@@ -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();

View File

@@ -9,7 +9,7 @@ public class AudioSound
[Range(0f, 1f)]
public float volume;
[Range(.1f, 3f)]
[Range(0.1f, 3f)]
public float pitch;
[HideInInspector]

View File

@@ -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