mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 08:57:39 +02:00
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:
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
Reference in New Issue
Block a user