Compare commits

...

2 Commits

Author SHA1 Message Date
GamerClassN7
4125ab62bb Update EditorBuildSettings.asset 2021-01-31 11:43:49 +01:00
GamerClassN7
30e89e1a43 Audio 2021-01-31 11:43:48 +01:00
5 changed files with 167 additions and 20 deletions

View File

@ -92,6 +92,36 @@ Light:
m_UseBoundingSphereOverride: 0 m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0 m_ShadowRadius: 0
m_ShadowAngle: 0 m_ShadowAngle: 0
--- !u!1 &3454083825413701809
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2859544536000255872}
m_Layer: 0
m_Name: AudioManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2859544536000255872
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3454083825413701809}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7094923891560833917}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7094923890942819438 --- !u!1 &7094923890942819438
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -269,6 +299,7 @@ Transform:
m_Children: m_Children:
- {fileID: 7094923890942819435} - {fileID: 7094923890942819435}
- {fileID: 7552584426519275258} - {fileID: 7552584426519275258}
- {fileID: 2859544536000255872}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -342,12 +373,6 @@ MonoBehaviour:
- {fileID: 2644881069278570743, guid: 94642d7ef8c97e544af1d5ca3596a37f, type: 3} - {fileID: 2644881069278570743, guid: 94642d7ef8c97e544af1d5ca3596a37f, type: 3}
- {fileID: 7945524436670112111, guid: 2d077f1b027540045b6833e51a067855, type: 3} - {fileID: 7945524436670112111, guid: 2d077f1b027540045b6833e51a067855, type: 3}
- {fileID: 7411583397803452420, guid: d42abe5652faa4543b100c9bf55091a7, type: 3} - {fileID: 7411583397803452420, guid: d42abe5652faa4543b100c9bf55091a7, type: 3}
powerIcons:
- {fileID: 21300000, guid: b486233fe80c73e41ad238593d9950d7, type: 3}
- {fileID: 21300000, guid: 39371c4e9eb74b4449614b13a886d673, type: 3}
- {fileID: 21300000, guid: 54d88af8950445844b1b95a6339ab8d1, type: 3}
- {fileID: 21300000, guid: 92bad1a4524af17479ce7b274fd4c941, type: 3}
powerImage: {fileID: 0}
dashPower: 40 dashPower: 40
dashTime: 0.3 dashTime: 0.3
--- !u!95 &7009705026125325791 --- !u!95 &7009705026125325791
@ -381,6 +406,102 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d6a0240c7e91f1644908b3c8bb8d9c96, type: 3} m_Script: {fileID: 11500000, guid: d6a0240c7e91f1644908b3c8bb8d9c96, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!82 &7756717506152340812
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7177606588354821184}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1001 &8023887280909926673 --- !u!1001 &8023887280909926673
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -2,28 +2,27 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Audio; using UnityEngine.Audio;
using System;
public class Audiomanager : MonoBehaviour public class Audiomanager : MonoBehaviour
{ {
public [] clips; public AudioSound[] clips;
// Start is called before the first frame update // Start is called before the first frame update
void Awake() void Awake()
{ {
foreach (AudioClip c in clips) foreach (AudioSound c in clips)
{ {
s.source = gameObject.AddComponent<AudionSource>(); c.source = gameObject.AddComponent<AudionSource>();
s.source.clip = s.clip; c.source.clip = c.clip;
s.source.volume = s.volume; c.source.volume = c.volume;
s.source.pitch = s.pitch; c.source.pitch = c.pitch;
} }
} }
// Update is called once per frame // Update is called once per frame
void Play(string name) void Play(string name)
{ {
Sound s = Array.Find(clips, sound => sound.name == name); AudioSound s = Array.Find(clips, sound => sound.name == name);
s.source.Play() s.source.Play();
} }
} }

View File

@ -0,0 +1,16 @@
using UnityEngine;
using UnityEngine.Audio;
public class AudioSound
{
public string name;
public AudioClip clip;
[Range(0f, 1f)]
public float volume;
[Range(.1f, 3f)]
public float pitch;
[HideInInspector]
public AudioSource source;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cd34753127bc0c44bb22ca73177fdd60
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -9,10 +9,7 @@ EditorBuildSettings:
path: Assets/Scenes/Menu/MainMenu.unity path: Assets/Scenes/Menu/MainMenu.unity
guid: 33d54f39f74b30b4dbb8d638a1d5c9b4 guid: 33d54f39f74b30b4dbb8d638a1d5c9b4
- enabled: 1 - enabled: 1
path: Assets/Scenes/Testing/Filip.unity path: Assets/Scenes/Levels/Level 1 _ vs.unity
guid: 326dea585e0ea574389529eaae8a0ab4
- enabled: 1
path: Assets/Scenes/Testing/Vasek.unity
guid: 127deaeaf7712824f83ee4cba639e023 guid: 127deaeaf7712824f83ee4cba639e023
- enabled: 1 - enabled: 1
path: Assets/Scenes/Levels/Level 2.unity path: Assets/Scenes/Levels/Level 2.unity
@ -20,6 +17,9 @@ EditorBuildSettings:
- enabled: 1 - enabled: 1
path: Assets/Scenes/Levels/Level 3.unity path: Assets/Scenes/Levels/Level 3.unity
guid: 7d7146aedfcd48445bb0d44a485249b2 guid: 7d7146aedfcd48445bb0d44a485249b2
- enabled: 1
path: Assets/Scenes/Testing/Filip.unity
guid: 326dea585e0ea574389529eaae8a0ab4
- enabled: 1 - enabled: 1
path: Assets/Scenes/Menu/FinalMenu.unity path: Assets/Scenes/Menu/FinalMenu.unity
guid: e728960f94bcba84089c530dec85aa8d guid: e728960f94bcba84089c530dec85aa8d