Auto-Swing (#827)

* BurstLinq

make BGM resync when changing pitch (to test)

* autoswing

some game implementations, most games already work fine

* more game tweaks

* 16th note swing

more game fixes
make pitch change resync optional in the API

* suppress some common warnings

* Update Credits.txt
This commit is contained in:
minenice55
2024-04-07 00:54:06 -04:00
committed by minenice55
parent 47905fffc2
commit a3f33e5279
49 changed files with 2372 additions and 242 deletions

View File

@ -34,10 +34,10 @@ namespace HeavenStudio.Util
/// <param name="length">duration of animation (progress 1.0)</param>
/// <param name="timeScale">multiplier for animation progress (smaller values make animation slower)</param>
/// <param name="animLayer">animator layer to play animation on</param>
public static void DoScaledAnimation(this Animator anim, string animName, double startTime, double length = 1, float timeScale = 1f, int animLayer = -1, bool clamp = false)
public static void DoScaledAnimation(this Animator anim, string animName, double startTime, double length = 1, float timeScale = 1f, int animLayer = -1, bool clamp = false, bool ignoreSwing = true)
{
if (anim == null) return;
float pos = Conductor.instance.GetPositionFromBeat(startTime, length) * timeScale;
float pos = Conductor.instance.GetPositionFromBeat(startTime, length, ignoreSwing: ignoreSwing) * timeScale;
if (clamp) pos = Mathf.Clamp01(pos);
anim.Play(animName, animLayer, pos);
anim.speed = 1f; //not 0 so these can still play their script events

View File

@ -106,5 +106,17 @@ namespace HeavenStudio.Util
}
Destroy(gameObject);
}
public void StopAll(bool destroy = false)
{
foreach (Util.Sound sound in playingSounds)
{
sound.Stop();
}
if (destroy)
{
Destroy(gameObject);
}
}
}
}

View File

@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using BurstLinq;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using UnityEngine;