refactor out to SFX class
This commit is contained in:
parent
e9c8e96d7f
commit
b5568e2a68
3 changed files with 15 additions and 11 deletions
12
src/Mono.cs
12
src/Mono.cs
|
@ -30,14 +30,6 @@ static class Mono
|
|||
public static DeltaBool food_fall = new(false);
|
||||
public static double eat_timestamp = 0.0;
|
||||
|
||||
// put in SFX static class
|
||||
static void PlayBox(this Sound sound, XYZi pos)
|
||||
{
|
||||
sound.Play(box_pose.ToMatrix(box_scale) * pos.ToVec3);
|
||||
}
|
||||
public static Sound sfx_crisp_nom = Sound.FromFile("sfx/crisp_nom.mp3");
|
||||
public static Sound sfx_punch_through = Sound.FromFile("sfx/punch_through.mp3");
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
for (int i = 0; i < snake.Length; i++)
|
||||
|
@ -145,7 +137,7 @@ static class Mono
|
|||
if (in_box.delta != 0) // 1 just in -1 just out
|
||||
{
|
||||
holes.Add(snake[0], snake_dir);
|
||||
sfx_punch_through.PlayBox(snake[0]);
|
||||
SFX.punch_through.PlayBox(snake[0]);
|
||||
}
|
||||
if (holes.ContainsKey(snake[snake_len - 1]))
|
||||
{
|
||||
|
@ -165,7 +157,7 @@ static class Mono
|
|||
grow_buffer += 3;
|
||||
|
||||
Feed();
|
||||
sfx_crisp_nom.PlayBox(snake[0]);
|
||||
SFX.crisp_nom.PlayBox(snake[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System.Collections.Generic;
|
||||
using StereoKit;
|
||||
|
||||
namespace snake;
|
||||
|
|
13
src/SFX.cs
Normal file
13
src/SFX.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using StereoKit;
|
||||
|
||||
namespace snake;
|
||||
|
||||
static class SFX
|
||||
{
|
||||
public static void PlayBox(this Sound sound, XYZi pos)
|
||||
{
|
||||
sound.Play(Mono.box_pose.ToMatrix(Mono.box_scale) * pos.ToVec3);
|
||||
}
|
||||
public static Sound crisp_nom = Sound.FromFile("sfx/crisp_nom.mp3");
|
||||
public static Sound punch_through = Sound.FromFile("sfx/punch_through.mp3");
|
||||
}
|
Loading…
Add table
Reference in a new issue