bounce sound avoid duplication
This commit is contained in:
parent
ff44126316
commit
153459432a
|
@ -1,5 +1,3 @@
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using NaughtyBezierCurves;
|
using NaughtyBezierCurves;
|
||||||
|
@ -48,12 +46,7 @@ namespace HeavenStudio.Games.Scripts_BouncyRoad
|
||||||
|
|
||||||
private void Bounce()
|
private void Bounce()
|
||||||
{
|
{
|
||||||
var sounds = new List<MultiSound.Sound>();
|
game.PlayBounceSound(startBeat, lengthBeat);
|
||||||
for (int i = 0; i < 12 ; i++)
|
|
||||||
{
|
|
||||||
sounds.Add(new MultiSound.Sound("bouncyRoad/ballBounce", startBeat + i * lengthBeat));
|
|
||||||
}
|
|
||||||
MultiSound.Play(sounds.ToArray());
|
|
||||||
|
|
||||||
var actions = new List<BeatAction.Action>();
|
var actions = new List<BeatAction.Action>();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using NaughtyBezierCurves;
|
using NaughtyBezierCurves;
|
||||||
|
@ -8,8 +6,6 @@ using NaughtyBezierCurves;
|
||||||
using HeavenStudio.Util;
|
using HeavenStudio.Util;
|
||||||
using HeavenStudio.InputSystem;
|
using HeavenStudio.InputSystem;
|
||||||
|
|
||||||
using Jukebox;
|
|
||||||
|
|
||||||
namespace HeavenStudio.Games.Loaders
|
namespace HeavenStudio.Games.Loaders
|
||||||
{
|
{
|
||||||
using static Minigames;
|
using static Minigames;
|
||||||
|
@ -238,6 +234,19 @@ namespace HeavenStudio.Games
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<double> bounceBeats = new();
|
||||||
|
public void PlayBounceSound(double beat, double length)
|
||||||
|
{
|
||||||
|
var sounds = new List<MultiSound.Sound>();
|
||||||
|
for (int i = 0; i < 12 ; i++)
|
||||||
|
{
|
||||||
|
var bounceBeat = beat + i * length;
|
||||||
|
if (!bounceBeats.Contains(bounceBeat)) sounds.Add(new MultiSound.Sound("bouncyRoad/ballBounce", bounceBeat));
|
||||||
|
bounceBeats.Add(bounceBeat);
|
||||||
|
}
|
||||||
|
MultiSound.Play(sounds.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
private Transform GenerateInitCurve(Vector3 pos1, Vector3 pos2)
|
private Transform GenerateInitCurve(Vector3 pos1, Vector3 pos2)
|
||||||
{
|
{
|
||||||
float dist = Vector3.Distance(pos1, pos2);
|
float dist = Vector3.Distance(pos1, pos2);
|
||||||
|
|
Loading…
Reference in a new issue