music intesinity
This commit is contained in:
parent
25e41b210a
commit
e1ccd7f8ff
|
@ -12,6 +12,7 @@ GameObject:
|
||||||
- component: {fileID: 420908950823711560}
|
- component: {fileID: 420908950823711560}
|
||||||
- component: {fileID: 6434302952035194364}
|
- component: {fileID: 6434302952035194364}
|
||||||
- component: {fileID: 3776162552967268432}
|
- component: {fileID: 3776162552967268432}
|
||||||
|
- component: {fileID: 4575217513678934597}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Managers
|
m_Name: Managers
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -46,7 +47,11 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 00e1f7ea5be7c564faf42d035aec7f53, type: 3}
|
m_Script: {fileID: 11500000, guid: 00e1f7ea5be7c564faf42d035aec7f53, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Balance: 0
|
Balance:
|
||||||
|
value: 500
|
||||||
|
onValueChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
IsBuildMode: 0
|
IsBuildMode: 0
|
||||||
--- !u!114 &6434302952035194364
|
--- !u!114 &6434302952035194364
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
|
@ -73,8 +78,51 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: f2cd736facf1d954d981c917c80d9c25, type: 3}
|
m_Script: {fileID: 11500000, guid: f2cd736facf1d954d981c917c80d9c25, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
HasStarted: 0
|
||||||
IsAutoPlaying: 0
|
IsAutoPlaying: 0
|
||||||
levelDefinition: {fileID: 11400000, guid: c8d456118a95ada459f30817ed2351a2, type: 2}
|
levelDefinition: {fileID: 11400000, guid: c8d456118a95ada459f30817ed2351a2, type: 2}
|
||||||
enemyCollection: {fileID: 11400000, guid: d600de6e8946fe54db15d9208f6f63f5, type: 2}
|
enemyCollection: {fileID: 11400000, guid: d600de6e8946fe54db15d9208f6f63f5, type: 2}
|
||||||
groundPath: {fileID: 0}
|
groundPath: {fileID: 0}
|
||||||
skyPath: {fileID: 0}
|
skyPath: {fileID: 0}
|
||||||
|
PlayButton: {fileID: 0}
|
||||||
|
AutoPlayButton: {fileID: 0}
|
||||||
|
--- !u!114 &4575217513678934597
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 167310329963132665}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 39d50303aa616fba99c8ad2b1addfb21, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
projectilesToIntensity:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0.06666667
|
||||||
|
outSlope: 0.06666667
|
||||||
|
tangentMode: 34
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0
|
||||||
|
outWeight: 0.33333334
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 30
|
||||||
|
value: 3
|
||||||
|
inSlope: 0.06666667
|
||||||
|
outSlope: 0.06666667
|
||||||
|
tangentMode: 34
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
intensities:
|
||||||
|
- {fileID: 8300000, guid: 8e038767673552d4fb9f6e5927df20b2, type: 3}
|
||||||
|
- {fileID: 8300000, guid: c37548871dcc24746aef5f5f5d248453, type: 3}
|
||||||
|
- {fileID: 8300000, guid: d0fe8353aa0b5024699b5632cb56d98f, type: 3}
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class HideWall : MonoBehaviour
|
||||||
|
|
||||||
foreach (var prevHitObject in prevHitObjects)
|
foreach (var prevHitObject in prevHitObjects)
|
||||||
{
|
{
|
||||||
|
if (prevHitObject == null) break;
|
||||||
if (!hitObjectsThisFrame.Contains(prevHitObject))
|
if (!hitObjectsThisFrame.Contains(prevHitObject))
|
||||||
{
|
{
|
||||||
var wallOpacity = prevHitObject.GetComponent<WallOpacity>();
|
var wallOpacity = prevHitObject.GetComponent<WallOpacity>();
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class MusicManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] AnimationCurve projectilesToIntensity;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
AudioClip[] intensities;
|
||||||
|
|
||||||
|
private int prevIntinsity = -1;
|
||||||
|
|
||||||
|
private AudioSource[] sources;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
sources = new AudioSource[intensities.Length];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
int projectileCount = GameObject.FindObjectsByType<Projectile>(FindObjectsSortMode.None).Length;
|
||||||
|
int intensity = (int) projectilesToIntensity.Evaluate(projectileCount) - 1;
|
||||||
|
|
||||||
|
if (intensity > prevIntinsity)
|
||||||
|
{
|
||||||
|
sources[intensity] = AudioManager.PlaySound(intensities[intensity], Vector3.zero, false, false, true, true);
|
||||||
|
}
|
||||||
|
else if (intensity < prevIntinsity)
|
||||||
|
{
|
||||||
|
if (sources[prevIntinsity] != null)
|
||||||
|
sources[prevIntinsity].Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
prevIntinsity = intensity;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 39d50303aa616fba99c8ad2b1addfb21
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue