Updates on audio

This commit is contained in:
mushgunAX 2023-02-03 19:37:18 +08:00
parent 60fa4335a0
commit a6bc9ed2b4
6 changed files with 20 additions and 16 deletions

View File

@ -103,22 +103,15 @@ public partial class Homeowner1 : BehaviourTree
//These should be somewhere else //These should be somewhere else
Debug.Log("TESTING"); //Debug.Log("TESTING");
AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected"); AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected");
Audio.AddAudioClipToBGMChannelGroup(AudioHandler.audioClipHandlers["BGMUnalert"]);
AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected"); AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected");
Audio.AddAudioClipToBGMChannelGroup(AudioHandler.audioClipHandlers["BGMAlert"]);
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive"); AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
Audio.AddAudioClipToBGMChannelGroup(AudioHandler.audioClipHandlers["BGMAdaptive"]);
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming"); AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
Audio.AddAudioClipToSFXChannelGroup(AudioHandler.audioClipHandlers["SFXHumming"]);
AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps"); AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
Audio.AddAudioClipToSFXChannelGroup(AudioHandler.audioClipHandlers["SFXFootstep"]);
AudioHandler.audioClipHandlers["SFXDetectAh"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_detect_raccoon"); AudioHandler.audioClipHandlers["SFXDetectAh"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_detect_raccoon");
Audio.AddAudioClipToSFXChannelGroup(AudioHandler.audioClipHandlers["SFXDetectAh"]);
AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected"); AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected");
Audio.AddAudioClipToSFXChannelGroup(AudioHandler.audioClipHandlers["SFXDetectSting"]);
} }
//Called every tick //Called every tick

View File

@ -1,4 +1,5 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -31,6 +32,8 @@ public class Breakable : Script
} }
isBreak = false; isBreak = false;
AudioHandler.audioClipHandlers["SFXBreak"] = Audio.CreateAudioClip("event:/Props/impact_break");
} }
protected override void update() protected override void update()
@ -69,7 +72,7 @@ public class Breakable : Script
} }
isBreak = false; isBreak = false;
Audio.PlaySFXOnce2D("event:/Props/impact_break"); AudioHandler.audioClipHandlers["SFXBreak"].Play();
GameObject.SetActive(false); GameObject.SetActive(false);
} }
} }

View File

@ -1,4 +1,5 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
public class Item : Script public class Item : Script
{ {
@ -29,6 +30,9 @@ public class Item : Script
collider.GetCollisionShape(0).Density = density; collider.GetCollisionShape(0).Density = density;
returnBack = false; returnBack = false;
AudioHandler.audioClipHandlers["SFXImpactElastic"] = Audio.CreateAudioClip("event:/Props/impact_elastic");
AudioHandler.audioClipHandlers["SFXImpactHard"] = Audio.CreateAudioClip("event:/Props/impact_hard");
} }
protected override void start() protected override void start()
@ -54,11 +58,11 @@ public class Item : Script
} }
if (playSound) if (playSound)
{ {
if(currCategory == ItemCategory.LIGHT) if (currCategory == ItemCategory.LIGHT)
Audio.PlaySFXOnce2D("event:/Props/impact_elastic"); AudioHandler.audioClipHandlers["SFXImpactElastic"].Play();
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY) else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
Audio.PlaySFXOnce2D("event:/Props/impact_hard"); AudioHandler.audioClipHandlers["SFXImpactHard"].Play();
playSound = false; playSound = false;
} }

View File

@ -1,5 +1,6 @@
using SHADE; using SHADE;
using SHADE_Scripting; using SHADE_Scripting;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using static PlayerController; using static PlayerController;
@ -43,6 +44,8 @@ public class PickAndThrow : Script
if(!tpc) if(!tpc)
Debug.LogError("TPC EMPTY"); Debug.LogError("TPC EMPTY");
AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw");
timer = delayTimer; timer = delayTimer;
} }
protected override void update() protected override void update()
@ -72,7 +75,7 @@ public class PickAndThrow : Script
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming) if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
{ {
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_throw"); AudioHandler.audioClipHandlers["SFXThrow"].Play();
itemRidigBody.IsGravityEnabled = true; itemRidigBody.IsGravityEnabled = true;
itemCollider.GetCollisionShape(0).IsTrigger = false; itemCollider.GetCollisionShape(0).IsTrigger = false;
pc.isAiming = false; pc.isAiming = false;

View File

@ -37,7 +37,6 @@ public class GameManager : Script
Instance = this; Instance = this;
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive"); AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
Audio.AddAudioClipToBGMChannelGroup(AudioHandler.audioClipHandlers["BGMAdaptive"]);
AudioHandler.audioClipHandlers["BGMAdaptive"].Play(); AudioHandler.audioClipHandlers["BGMAdaptive"].Play();
AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f); AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
//Audio.PlayBGMOnce2D("event:/Music/player_undetected"); //Audio.PlayBGMOnce2D("event:/Music/player_undetected");

View File

@ -1,17 +1,19 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
public class ScoringZone : Script public class ScoringZone : Script
{ {
protected override void awake() protected override void awake()
{ {
AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored");
} }
protected override void onTriggerEnter(CollisionInfo info) protected override void onTriggerEnter(CollisionInfo info)
{ {
if (GameManager.Instance && info.GameObject.GetScript<Item>()) if (GameManager.Instance && info.GameObject.GetScript<Item>())
{ {
Audio.PlaySFXOnce2D("event:/Music/stingers/item_scored"); AudioHandler.audioClipHandlers["SFXItemScore"].Play();
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score; GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score;
GameManager.Instance.totalItemCount -= 1; GameManager.Instance.totalItemCount -= 1;
info.GameObject.SetActive(false); info.GameObject.SetActive(false);