Done with Audio Implementation via C# #347

Merged
mushgunAX merged 14 commits from AudioImplementation into main 2023-02-04 10:18:26 +08:00
10 changed files with 24 additions and 12 deletions
Showing only changes of commit d1a3214d41 - Show all commits

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -103,10 +103,13 @@ public partial class Homeowner1 : BehaviourTree
//These should be somewhere else
Debug.Log("TESTING");
AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected");
Audio.AddAudioClipToBGMChannelGroup(AudioHandler.audioClipHandlers["BGMUnalert"]);
AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected");
Audio.AddAudioClipToBGMChannelGroup(AudioHandler.audioClipHandlers["BGMAlert"]);
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
Audio.AddAudioClipToBGMChannelGroup(AudioHandler.audioClipHandlers["BGMAdaptive"]);
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
Audio.AddAudioClipToSFXChannelGroup(AudioHandler.audioClipHandlers["SFXHumming"]);
@ -116,7 +119,6 @@ public partial class Homeowner1 : BehaviourTree
Audio.AddAudioClipToSFXChannelGroup(AudioHandler.audioClipHandlers["SFXDetectAh"]);
AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected");
Audio.AddAudioClipToSFXChannelGroup(AudioHandler.audioClipHandlers["SFXDetectSting"]);
}
//Called every tick
@ -158,8 +160,8 @@ public partial class Homeowner1 : BehaviourTree
footstepTimeRemaining -= velocity * Time.DeltaTimeF;
if (footstepTimeRemaining < 0.0f)
{
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_footsteps");
AudioHandler.audioClipHandlers["SFXFootstep"].Play();
//Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_footsteps");
//AudioHandler.audioClipHandlers["SFXFootstep"].Play();
footstepTimeRemaining = footstepSFXIntervalMultiplier;
}
//Debug.Log("Ticked");

View File

@ -112,6 +112,7 @@ public partial class LeafChase : BehaviourTreeNode
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
{
AudioHandler.audioClipHandlers["BGMAdpative"].SetParameter("Detected", 0.0f);
AudioHandler.audioClipHandlers["SFXHumming"].Play();
}
SetNodeData("isAlert", false);

View File

@ -240,10 +240,11 @@ public partial class LeafPatrol : BehaviourTreeNode
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert"))
{
//Debug.Log("Unalert");
AudioHandler.audioClipHandlers["BGMAlert"].Stop(true);
//AudioHandler.audioClipHandlers["BGMAlert"].Stop(true);
//Audio.PlaySFXOnce2D("event:/Homeowner/humming");
AudioHandler.audioClipHandlers["SFXHumming"].Play();
AudioHandler.audioClipHandlers["BGMUnalert"].Play();
//AudioHandler.audioClipHandlers["BGMUnalert"].Play();
AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
}
SetNodeData("isAlert", false);
}

View File

@ -66,6 +66,7 @@ public partial class LeafSearch : BehaviourTreeNode
{
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
{
AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
AudioHandler.audioClipHandlers["SFXHumming"].Play();
reevaluateWaypoint();
}
@ -186,23 +187,25 @@ public partial class LeafSearch : BehaviourTreeNode
if (GetNodeData("isAlert") == null)
{
SetNodeData("isAlert", true);
Audio.StopAllSounds();
//Audio.StopAllSounds();
AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
AudioHandler.audioClipHandlers["SFXDetectSting"].Play();
AudioHandler.audioClipHandlers["BGMAlert"].Play();
//AudioHandler.audioClipHandlers["BGMAlert"].Play();
AudioHandler.audioClipHandlers["SFXHumming"].Stop(false);
AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
//AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f);
}
else
{
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == false)
{
Audio.StopAllSounds();
//Audio.StopAllSounds();
AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
AudioHandler.audioClipHandlers["SFXDetectSting"].Play();
AudioHandler.audioClipHandlers["BGMAlert"].Play();
//AudioHandler.audioClipHandlers["BGMAlert"].Play();
AudioHandler.audioClipHandlers["SFXHumming"].Stop(false);
AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
//AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f);
}
SetNodeData("isAlert", true);
}

View File

@ -1,4 +1,5 @@
using SHADE;
using SHADE_Scripting.Audio;
using System;
using System.Collections.Generic;
@ -35,7 +36,11 @@ public class GameManager : Script
else
Instance = this;
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
Audio.AddAudioClipToBGMChannelGroup(AudioHandler.audioClipHandlers["BGMAdaptive"]);
AudioHandler.audioClipHandlers["BGMAdaptive"].Play();
AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
//Audio.PlayBGMOnce2D("event:/Music/player_undetected");
Audio.PlayBGMOnce2D("event:/Ambience/roomtone_kitchen");
totalItemCount = 0;
Score = 0;