Added cutscene audio #420

Merged
srishamharan merged 3 commits from AudioImpl into main 2023-03-10 19:39:42 +08:00
10 changed files with 131 additions and 10 deletions

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: Cinematics
ID: 197932678
Type: 11

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using SHADE;
using SHADE_Scripting.Audio;
public class CutsceneEnd : Script
{
@ -58,6 +58,17 @@ public class CutsceneEnd : Script
{
initCutscene4();
initCutscene5();
AudioHandler.audioClipHandlers["cutsceneBGM"] = Audio.CreateAudioClip("event:/Cinematics/BGM");
AudioHandler.audioClipHandlers["cutscenePanelSlide"] = Audio.CreateAudioClip("event:/Cinematics/panel_slide");
//Cutscene 4 Audio
AudioHandler.audioClipHandlers["cutscene4Run"] = Audio.CreateAudioClip("event:/Cinematics/4/1_run");
//Cutscene 5 Audio
AudioHandler.audioClipHandlers["cutscene5Yay"] = Audio.CreateAudioClip("event:/Cinematics/5/2_yay");
AudioHandler.audioClipHandlers["cutsceneBGM"].Play();
}
protected override void update()
@ -70,6 +81,11 @@ public class CutsceneEnd : Script
skip = true;
oldDuration = duration;
duration = skipDuration;
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Stop(true);
AudioHandler.audioClipHandlers["cutscene4Run"].Stop(true);
AudioHandler.audioClipHandlers["cutscene5Yay"].Stop(true);
}
if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf)
@ -90,6 +106,11 @@ public class CutsceneEnd : Script
{
if (canvas4.IsActiveSelf)
{
if(time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene4Run"].Play();
}
if (showPic4a)
{
if (time < duration)
@ -116,6 +137,10 @@ public class CutsceneEnd : Script
if (showPic4b)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration)
{
pic4bTran.LocalPosition = Vector3.Lerp(pic4bTran.LocalPosition, listOfCutscene4Points[1].LocalPosition, time / duration);
@ -140,6 +165,10 @@ public class CutsceneEnd : Script
if (showPic4c)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration)
{
pic4cTran.LocalPosition = Vector3.Lerp(pic4cTran.LocalPosition, listOfCutscene4Points[2].LocalPosition, time / duration);
@ -171,6 +200,10 @@ public class CutsceneEnd : Script
{
if (showPic5a)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration)
{
pic5aTran.LocalPosition = Vector3.Lerp(pic5aTran.LocalPosition, listOfCutscene5Points[0].LocalPosition, time / duration);
@ -195,6 +228,11 @@ public class CutsceneEnd : Script
if (showPic5b)
{
if (time == 0)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene5Yay"].Play();
}
if (time < duration)
{
pic5bTran.LocalPosition = Vector3.Lerp(pic5bTran.LocalPosition, listOfCutscene5Points[1].LocalPosition, time / duration);

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using SHADE;
using SHADE_Scripting.Audio;
public class CutsceneIntro : Script
{
@ -87,6 +87,24 @@ public class CutsceneIntro : Script
initCutscene1();
initCutscene2();
initCutscene3();
//Cutscene BGM
AudioHandler.audioClipHandlers["cutsceneBGM"] = Audio.CreateAudioClip("event:/Cinematics/BGM");
AudioHandler.audioClipHandlers["cutscenePanelSlide"] = Audio.CreateAudioClip("event:/Cinematics/panel_slide");
//Cutscene 2 Audio
AudioHandler.audioClipHandlers["cutscene2Stomach"] = Audio.CreateAudioClip("event:/Cinematics/2/1_stomach");
AudioHandler.audioClipHandlers["cutscene2Alert"] = Audio.CreateAudioClip("event:/Cinematics/2/2_alert");
AudioHandler.audioClipHandlers["cutscene2Sparkle"] = Audio.CreateAudioClip("event:/Cinematics/2/3_sparkle");
//Cutscene 3 Audio
AudioHandler.audioClipHandlers["cutscene3Jump"] = Audio.CreateAudioClip("event:/Cinematics/3/1_jump");
AudioHandler.audioClipHandlers["cutscene3Sparkle"] = Audio.CreateAudioClip("event:/Cinematics/3/2_sparkle");
AudioHandler.audioClipHandlers["cutscene3Carry"] = Audio.CreateAudioClip("event:/Cinematics/3/3_carry");
AudioHandler.audioClipHandlers["cutscene3Throw"] = Audio.CreateAudioClip("event:/Cinematics/3/4_throw");
AudioHandler.audioClipHandlers["cutscene3Yay"] = Audio.CreateAudioClip("event:/Cinematics/3/5_yay");
AudioHandler.audioClipHandlers["cutsceneBGM"].Play();
}
protected override void update()
@ -98,6 +116,16 @@ public class CutsceneIntro : Script
if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
{
skip = true;
AudioHandler.audioClipHandlers["cutscene2Stomach"].Stop(true);
AudioHandler.audioClipHandlers["cutscene2Alert"].Stop(true);
AudioHandler.audioClipHandlers["cutscene2Sparkle"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Jump"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Sparkle"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Carry"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Throw"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Yay"].Stop(true);
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Stop(true);
oldDuration = duration;
duration = skipDuration;
}
@ -128,6 +156,10 @@ public class CutsceneIntro : Script
{
if (canvas1.IsActiveSelf)
{
if(time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (showPic1a)
{
if (time < duration)
@ -154,6 +186,10 @@ public class CutsceneIntro : Script
if (showPic1b)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration)
{
pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, time / duration);
@ -178,6 +214,10 @@ public class CutsceneIntro : Script
if (showPic1c)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration)
{
pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, time / duration);
@ -209,6 +249,11 @@ public class CutsceneIntro : Script
{
if (showPic2a)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene2Stomach"].Play();
}
if (time < duration)
{
pic2aTran.LocalPosition = Vector3.Lerp(pic2aTran.LocalPosition, listOfCutscene2Points[0].LocalPosition, time / duration);
@ -233,6 +278,11 @@ public class CutsceneIntro : Script
if (showPic2b)
{
if(time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene2Alert"].Play();
}
if (time < duration)
{
pic2bTran.LocalPosition = Vector3.Lerp(pic2bTran.LocalPosition, listOfCutscene2Points[1].LocalPosition, time / duration);
@ -257,6 +307,11 @@ public class CutsceneIntro : Script
if (showPic2c)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene2Sparkle"].Play();
}
if (time < duration)
{
pic2cTran.LocalPosition = Vector3.Lerp(pic2cTran.LocalPosition, listOfCutscene2Points[2].LocalPosition, time / duration);
@ -288,6 +343,11 @@ public class CutsceneIntro : Script
{
if (showPic3a)
{
if(time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Jump"].Play();
}
if (time < duration)
{
pic3aTran.LocalPosition = Vector3.Lerp(pic3aTran.LocalPosition, listOfCutscene3Points[0].LocalPosition, time / duration);
@ -312,6 +372,11 @@ public class CutsceneIntro : Script
if (showPic3b)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Sparkle"].Play();
}
if (time < duration)
{
pic3bTran.LocalPosition = Vector3.Lerp(pic3bTran.LocalPosition, listOfCutscene3Points[1].LocalPosition, time / duration);
@ -336,6 +401,11 @@ public class CutsceneIntro : Script
if (showPic3c)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Carry"].Play();
}
if (time < duration)
{
pic3cTran.LocalPosition = Vector3.Lerp(pic3cTran.LocalPosition, listOfCutscene3Points[2].LocalPosition, time / duration);
@ -360,6 +430,11 @@ public class CutsceneIntro : Script
if (showPic3d)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Throw"].Play();
}
if (time < duration)
{
pic3dTran.LocalPosition = Vector3.Lerp(pic3dTran.LocalPosition, listOfCutscene3Points[3].LocalPosition, time / duration);
@ -384,6 +459,11 @@ public class CutsceneIntro : Script
if (showPic3e)
{
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Yay"].Play();
}
if (time < duration)
{
pic3eTran.LocalPosition = Vector3.Lerp(pic3eTran.LocalPosition, listOfCutscene3Points[4].LocalPosition, time / duration);

View File

@ -31,7 +31,6 @@ namespace SHADE_Scripting.UI
if (mv != null)
{
mv.ScaledValue = Settings.masterVolume;
}
if (sfx != null)
{
@ -68,19 +67,19 @@ namespace SHADE_Scripting.UI
if (mv != null)
{
Settings.masterVolume = mv.ScaledValue * 0.01f;
SHADE.Audio.SetVCAVolume("vca:/MASTER", Settings.masterVolume);
Settings.masterVolume = mv.ScaledValue;
SHADE.Audio.SetVCAVolume("vca:/MASTER", Settings.masterVolume * 0.01f);
}
if (sfx != null)
{
Settings.sfxVolume = sfx.ScaledValue * 0.01f;
SHADE.Audio.SetVCAVolume("vca:/SFX", Settings.sfxVolume);
SHADE.Audio.SetVCAVolume("vca:/UI", Settings.sfxVolume);
Settings.sfxVolume = sfx.ScaledValue;
SHADE.Audio.SetVCAVolume("vca:/SFX", Settings.sfxVolume * 0.01f);
SHADE.Audio.SetVCAVolume("vca:/UI", Settings.sfxVolume * 0.01f);
}
if (bgm != null)
{
Settings.bgmVolume = bgm.ScaledValue * 0.01f;
SHADE.Audio.SetVCAVolume("vca:/MUSIC", Settings.bgmVolume);
Settings.bgmVolume = bgm.ScaledValue;
SHADE.Audio.SetVCAVolume("vca:/MUSIC", Settings.bgmVolume * 0.01f);
}
if (fov != null)
{

View File

@ -115,6 +115,7 @@ namespace SHADE
LoadBank((AUDIO_FOLDER_PATH + "Master.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "Master.strings.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "Cinematics.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "SFX.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "UI.bank").data());