change old audio code

This commit is contained in:
Glence 2023-03-10 17:21:49 +08:00
parent 9eb5399f7b
commit a3318d500d
3 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,5 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
public class PlayerRunState : BaseState public class PlayerRunState : BaseState
@ -26,7 +27,7 @@ public class PlayerRunState : BaseState
if (timer > delay) if (timer > delay)
{ {
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps"); AudioHandler.audioClipHandlers["footsteps"].Play();
timer = 0; timer = 0;
} }
} }

View File

@ -1,4 +1,5 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
public class PlayerWalkState : BaseState public class PlayerWalkState : BaseState
@ -39,8 +40,8 @@ public class PlayerWalkState : BaseState
timer += Time.DeltaTimeF; timer += Time.DeltaTimeF;
if (timer > delay) if (timer > delay)
{ {
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps"); AudioHandler.audioClipHandlers["footsteps"].Play();
timer = 0; timer = 0;
} }
} }

View File

@ -1,6 +1,7 @@
using SHADE; using SHADE;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using SHADE_Scripting.Audio;
using static Item; using static Item;
public class PlayerController : Script public class PlayerController : Script
@ -131,6 +132,8 @@ public class PlayerController : Script
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>(); silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f); silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f);
} }
AudioHandler.audioClipHandlers["footsteps"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_footsteps");
} }
protected override void start() protected override void start()