Change animation playback timing
This commit is contained in:
parent
93f84e17cb
commit
12cfb6c527
BIN
Assets/Resources/Sfx/games/bonOdori/clap2.wav
Normal file
BIN
Assets/Resources/Sfx/games/bonOdori/clap2.wav
Normal file
Binary file not shown.
22
Assets/Resources/Sfx/games/bonOdori/clap2.wav.meta
Normal file
22
Assets/Resources/Sfx/games/bonOdori/clap2.wav.meta
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9f89ba33b52e16a49900d64c8c7f339c
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 6
|
||||||
|
defaultSettings:
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
preloadAudioData: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -61,7 +61,7 @@ namespace HeavenStudio.Games.Loaders
|
||||||
function = delegate {
|
function = delegate {
|
||||||
var e = eventCaller.currentEntity;
|
var e = eventCaller.currentEntity;
|
||||||
string variation = "variation" + (new string[] { "Don", "Do", "Do_n" })[e["type"]];
|
string variation = "variation" + (new string[] { "Don", "Do", "Do_n" })[e["type"]];
|
||||||
BonOdori.instance.Sound(e.beat, e[variation], e["type"], e["semitone"]);
|
BonOdori.instance.PlayDon(e.beat, e[variation], e["type"], e["semitone"]);
|
||||||
},
|
},
|
||||||
defaultLength = 1f,
|
defaultLength = 1f,
|
||||||
parameters = new List<Param>()
|
parameters = new List<Param>()
|
||||||
|
@ -166,13 +166,13 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
string prefix;
|
string prefix;
|
||||||
double beatUniversal;
|
double beatUniversal;
|
||||||
|
bool noBopPlayer = false;
|
||||||
|
bool noBopDonpans = false;
|
||||||
|
List<double> noBopBeatsPlayer = new ();
|
||||||
|
List<double> noBopBeatsDonpans = new ();
|
||||||
string suffix;
|
string suffix;
|
||||||
SpriteRenderer darkPlane;
|
SpriteRenderer darkPlane;
|
||||||
bool goBopDonpans;
|
string clapTypeString = "ClapFront";
|
||||||
bool goBopJudge;
|
|
||||||
bool bopDonpans;
|
|
||||||
int clapTypeGlobal = 0;
|
|
||||||
string clapTypeString = "ClapSide";
|
|
||||||
string[] originalTexts = new string[5];
|
string[] originalTexts = new string[5];
|
||||||
Coroutine[] Scrolls = new Coroutine[5];
|
Coroutine[] Scrolls = new Coroutine[5];
|
||||||
Coroutine DarkerBG;
|
Coroutine DarkerBG;
|
||||||
|
@ -254,10 +254,10 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
darkPlane = DarkPlane.GetComponent<SpriteRenderer>();
|
|
||||||
|
|
||||||
clapTypeGlobal = 0;
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
SetupBopRegion("bonOdori", "bop", "auto");
|
||||||
|
|
||||||
|
darkPlane = DarkPlane.GetComponent<SpriteRenderer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnStop()
|
public void OnStop()
|
||||||
|
@ -265,6 +265,13 @@ namespace HeavenStudio.Games
|
||||||
DarkPlane.GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f);
|
DarkPlane.GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnLateBeatPulse(double beat)
|
||||||
|
{
|
||||||
|
if (BeatIsInBopRegion(beat)) Bop(beat);
|
||||||
|
noBopBeatsPlayer.RemoveAll(x => x+4 < beat);
|
||||||
|
noBopBeatsDonpans.RemoveAll(x => x+4 < beat);
|
||||||
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
var cond = Conductor.instance;
|
var cond = Conductor.instance;
|
||||||
|
@ -286,27 +293,23 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
ScoreMiss();
|
ScoreMiss();
|
||||||
SoundByte.PlayOneShotGame("bonOdori/clap");
|
SoundByte.PlayOneShotGame("bonOdori/clap");
|
||||||
if (clapTypeGlobal == 0)
|
|
||||||
{
|
|
||||||
clapTypeString = "ClapSide";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clapTypeString = "ClapFront";
|
|
||||||
}
|
|
||||||
|
|
||||||
Donpans[0].DoScaledAnimationAsync(clapTypeString, 0.5f);
|
Donpans[0].DoScaledAnimationAsync(clapTypeString, 0.5f);
|
||||||
if (!goBopDonpans)
|
|
||||||
|
if (clapTypeString is "ClapFront")
|
||||||
{
|
{
|
||||||
|
var currentBeat = Conductor.instance.songPositionInBeatsAsDouble;
|
||||||
|
noBopBeatsPlayer.Add(currentBeat);
|
||||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beatUniversal + 1d, delegate {
|
new BeatAction.Action(currentBeat, delegate {
|
||||||
foreach (var chara in Donpans) {
|
noBopPlayer = true;
|
||||||
chara.DoScaledAnimationAsync("NeutralClapped", 0.5f);
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
});
|
new BeatAction.Action(currentBeat + 2d, delegate {
|
||||||
}
|
if (noBopBeatsPlayer[^1] == currentBeat) noBopPlayer = false;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -342,14 +345,6 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public void Clap(double beat, int variation, int typeSpeak, bool muted, int clapType, int semitone)
|
public void Clap(double beat, int variation, int typeSpeak, bool muted, int clapType, int semitone)
|
||||||
{
|
{
|
||||||
if (clapType == 1)
|
|
||||||
{
|
|
||||||
clapTypeGlobal = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clapTypeGlobal = 0;
|
|
||||||
}
|
|
||||||
if (!muted)
|
if (!muted)
|
||||||
{
|
{
|
||||||
string clip = typeSpeak switch
|
string clip = typeSpeak switch
|
||||||
|
@ -359,14 +354,36 @@ namespace HeavenStudio.Games
|
||||||
2 or _ => "pa_n",
|
2 or _ => "pa_n",
|
||||||
};
|
};
|
||||||
var pitch = SoundByte.GetPitchFromSemiTones(semitone, true);
|
var pitch = SoundByte.GetPitchFromSemiTones(semitone, true);
|
||||||
SoundByte.PlayOneShotGame($"bonOdori/" + clip + (variation + 1), beat, pitch);
|
SoundByte.PlayOneShotGame($"bonOdori/" + clip + (variation + 1), beat, pitch);
|
||||||
|
|
||||||
beatUniversal = beat;
|
|
||||||
}
|
}
|
||||||
|
SoundByte.PlayOneShotGame("bonOdori/clap2", beat, volume: 0.5f);
|
||||||
|
|
||||||
|
beatUniversal = beat;
|
||||||
|
noBopBeatsDonpans.Add(beatUniversal);
|
||||||
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||||
|
{
|
||||||
|
new BeatAction.Action(beat - 0.1d, delegate {
|
||||||
|
clapTypeString = clapType switch {
|
||||||
|
0 => "ClapSide",
|
||||||
|
1 or _ => "ClapFront",
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
new BeatAction.Action(beat, delegate {
|
||||||
|
foreach (var chara in Donpans[1..Donpans.Length]) {
|
||||||
|
chara.DoScaledAnimationAsync(clapTypeString, 0.5f);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
new BeatAction.Action(beat + 0.05d, delegate {
|
||||||
|
if (clapTypeString is "ClapFront") noBopDonpans = true;
|
||||||
|
}),
|
||||||
|
new BeatAction.Action(beat + 1.01d, delegate {
|
||||||
|
if (clapTypeString is "ClapFront") noBopDonpans = false;
|
||||||
|
}),
|
||||||
|
});
|
||||||
ScheduleInput(beat, 0f, InputAction_BasicPress, Success, Miss, Empty);
|
ScheduleInput(beat, 0f, InputAction_BasicPress, Success, Miss, Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Sound(double beat, int variation, int typeSpeak, int semitone)
|
public void PlayDon(double beat, int variation, int typeSpeak, int semitone)
|
||||||
{
|
{
|
||||||
string clip = typeSpeak switch
|
string clip = typeSpeak switch
|
||||||
{
|
{
|
||||||
|
@ -378,52 +395,47 @@ namespace HeavenStudio.Games
|
||||||
var pitch = SoundByte.GetPitchFromSemiTones(semitone, true);
|
var pitch = SoundByte.GetPitchFromSemiTones(semitone, true);
|
||||||
|
|
||||||
SoundByte.PlayOneShotGame($"bonOdori/" + clip + (variation + 1), beat, pitch);
|
SoundByte.PlayOneShotGame($"bonOdori/" + clip + (variation + 1), beat, pitch);
|
||||||
|
var firstPan = EventCaller.GetAllInGameManagerList("bonOdori", new string[] { "pan" }).Find(x => x.beat >= beat);
|
||||||
|
if (firstPan is not null)
|
||||||
|
{
|
||||||
|
clapTypeString = firstPan["clapType"] switch {
|
||||||
|
0 => "ClapSide",
|
||||||
|
1 or _ => "ClapFront",
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Success(PlayerActionEvent caller, float state)
|
public void Success(PlayerActionEvent caller, float state)
|
||||||
{
|
{
|
||||||
if (clapTypeGlobal == 0)
|
Donpans[0].DoScaledAnimationAsync(clapTypeString, 0.5f);
|
||||||
|
if (state <= -1f || state >= 1f)
|
||||||
{
|
{
|
||||||
clapTypeString = "ClapSide";
|
SoundByte.PlayOneShot("nearMiss");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
SoundByte.PlayOneShotGame("bonOdori/clap");
|
||||||
{
|
|
||||||
clapTypeString = "ClapFront";
|
var currentBeat = Conductor.instance.songPositionInBeatsAsDouble;
|
||||||
}
|
double closest = noBopBeatsDonpans.Aggregate((x, y) => Math.Abs(x - currentBeat) < Math.Abs(y - currentBeat) ? x : y);
|
||||||
foreach (var chara in Donpans) {
|
noBopBeatsPlayer.Add(closest);
|
||||||
chara.DoScaledAnimationAsync(clapTypeString, 0.5f);
|
if (clapTypeString is "ClapFront")
|
||||||
}
|
|
||||||
|
|
||||||
if (!goBopDonpans)
|
|
||||||
{
|
{
|
||||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beatUniversal + 1d, delegate {
|
new BeatAction.Action(closest + 0.05d, delegate {
|
||||||
foreach (var chara in Donpans) {
|
noBopPlayer = true;
|
||||||
chara.DoScaledAnimationAsync("NeutralClapped", 0.5f);
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
});
|
new BeatAction.Action(closest + 1.01d, delegate {
|
||||||
|
if (noBopBeatsPlayer[^1] == closest) noBopPlayer = false;
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
SoundByte.PlayOneShotGame("bonOdori/clap");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Miss(PlayerActionEvent caller)
|
public void Miss(PlayerActionEvent caller)
|
||||||
{
|
{
|
||||||
if (clapTypeGlobal == 0)
|
// SoundByte.PlayOneShot("miss");
|
||||||
{
|
|
||||||
clapTypeString = "ClapSide";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
clapTypeString = "ClapFront";
|
|
||||||
}
|
|
||||||
foreach (var chara in Donpans) {
|
|
||||||
chara.DoScaledAnimationAsync(clapTypeString, 0.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
SoundByte.PlayOneShot("miss");
|
|
||||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beatUniversal + 1d, delegate { JudgeFace.Play("Sad");}),
|
new BeatAction.Action(beatUniversal + 1d, delegate { JudgeFace.Play("Sad");}),
|
||||||
|
@ -583,54 +595,69 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public void ToggleBop(double beat, float length, bool bopOrNah, bool autoBop)
|
public void ToggleBop(double beat, float length, bool bopOrNah, bool autoBop)
|
||||||
{
|
{
|
||||||
goBopDonpans = autoBop; goBopJudge = autoBop;
|
|
||||||
if (autoBop) return;
|
if (autoBop) return;
|
||||||
if (bopOrNah)
|
if (bopOrNah)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
double bopBeat = beat + i;
|
||||||
|
BeatAction.New(instance, new() {new BeatAction.Action(bopBeat, delegate { Bop(bopBeat);})});
|
||||||
|
}
|
||||||
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||||
|
{
|
||||||
|
new BeatAction.Action(beat + length, delegate
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat + i, delegate
|
if (!noBopBeatsDonpans.Any(x => Math.Abs(x - (beat + length)) <= double.Epsilon)) {
|
||||||
{
|
|
||||||
foreach (var chara in Donpans) {
|
|
||||||
chara.DoScaledAnimationAsync("Bop", 0.5f);
|
|
||||||
}
|
|
||||||
Judge.DoScaledAnimationAsync("Bop", 0.5f);
|
|
||||||
|
|
||||||
}),
|
|
||||||
new BeatAction.Action(beat + length, delegate
|
|
||||||
{
|
|
||||||
foreach (var chara in Donpans) {
|
foreach (var chara in Donpans) {
|
||||||
chara.Play("NeutralBopped");
|
chara.Play("NeutralBopped");
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
});
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Bop(double beat)
|
||||||
|
{
|
||||||
|
if (!noBopPlayer & !noBopBeatsPlayer.Any(x => Math.Abs(x - beat) <= double.Epsilon))
|
||||||
|
{
|
||||||
|
if (!Donpans[0].IsPlayingAnimationNames("ClapSide", "ClapFront")) {
|
||||||
|
Donpans[0].DoScaledAnimationAsync("Bop", 0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!noBopDonpans & !noBopBeatsDonpans.Any(x => Math.Abs(x - beat) <= double.Epsilon))
|
||||||
|
{
|
||||||
|
foreach (var chara in Donpans[1..Donpans.Length]) {
|
||||||
|
if (!chara.IsPlayingAnimationNames("ClapSide", "ClapFront")) {
|
||||||
|
chara.DoScaledAnimationAsync("Bop", 0.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Judge.DoScaledAnimationAsync("Bop", 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Bow(double beat, float length)
|
public void Bow(double beat, float length)
|
||||||
{
|
{
|
||||||
if (goBopDonpans == true)
|
noBopPlayer = true;
|
||||||
{
|
noBopDonpans = true;
|
||||||
bopDonpans = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bopDonpans = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
goBopDonpans = false;
|
|
||||||
foreach (var chara in Donpans) {
|
foreach (var chara in Donpans) {
|
||||||
chara.Play("Bow");
|
chara.Play("Bow");
|
||||||
}
|
}
|
||||||
BeatAction.New(instance, new List<BeatAction.Action>()
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat + length, delegate {
|
new BeatAction.Action(beat + length, delegate {
|
||||||
foreach (var chara in Donpans) {
|
noBopPlayer = false;
|
||||||
chara.Play("NeutralBopped");
|
noBopDonpans = false;
|
||||||
}
|
if (!noBopBeatsPlayer.Any(x => Math.Abs(x - (beat + length)) <= double.Epsilon)) {
|
||||||
|
Donpans[0].Play("NeutralBopped");
|
||||||
|
if (BeatIsInBopRegion(beat + length)) Bop(beat + length);
|
||||||
|
}
|
||||||
|
if (!noBopBeatsDonpans.Any(x => Math.Abs(x - (beat + length)) <= double.Epsilon)) {
|
||||||
|
foreach (var chara in Donpans[1..Donpans.Length]) {
|
||||||
|
chara.Play("NeutralBopped");
|
||||||
|
}
|
||||||
|
if (BeatIsInBopRegion(beat + length)) Bop(beat + length);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -639,20 +666,6 @@ namespace HeavenStudio.Games
|
||||||
// {
|
// {
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public override void OnBeatPulse(double beat)
|
|
||||||
{
|
|
||||||
if (goBopDonpans)
|
|
||||||
{
|
|
||||||
foreach (var chara in Donpans) {
|
|
||||||
chara.DoScaledAnimationAsync("Bop", 0.5f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (goBopJudge)
|
|
||||||
{
|
|
||||||
Judge.DoScaledAnimationAsync("Bop", 0.5f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DarkBG(double beat, bool toggle, float length)
|
public void DarkBG(double beat, bool toggle, float length)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue