This repository has been archived by the owner on Sep 30, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated for Beat Saber version 0.11.0. Speed can be changed from 100%…
… + if playing without no fail, with no fail you can go below 100%.
- Loading branch information
Showing
8 changed files
with
130 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace PracticePlugin | ||
{ | ||
public class CustomNoteCutSoundEffect : NoteCutSoundEffect | ||
{ | ||
public static CustomNoteCutSoundEffect CopyOriginal(NoteCutSoundEffect original) | ||
{ | ||
var gameObj = Instantiate(original.gameObject); | ||
gameObj.name = "This is a copy!"; | ||
//gameObj.SetActive(false); | ||
original = gameObj.GetComponent<NoteCutSoundEffect>(); | ||
var noteCutSoundEffect = (CustomNoteCutSoundEffect) ReflectionUtil.CopyComponent(original, typeof(NoteCutSoundEffect), | ||
typeof(CustomNoteCutSoundEffect), gameObj); | ||
DestroyImmediate(original); | ||
noteCutSoundEffect.Awake(); | ||
return noteCutSoundEffect; | ||
} | ||
|
||
public override void Awake() | ||
{ | ||
if (_badCutSoundEffectAudioClips == null) return; | ||
base.Awake(); | ||
} | ||
|
||
public override void LateUpdate() | ||
{ | ||
if (_audioSource.clip == null) return; | ||
base.LateUpdate(); | ||
} | ||
|
||
public override void Init(AudioClip audioClip, float volumeScale, double noteDSPTime, float aheadTime, float missedTimeOffset, | ||
Saber saber, NoteData noteData, bool handleWrongSaberTypeAsGood) | ||
{ | ||
base.Init(audioClip, volumeScale, noteDSPTime, aheadTime, missedTimeOffset, saber, noteData, handleWrongSaberTypeAsGood); | ||
_audioSource.Stop(); | ||
var dspTime = AudioSettings.dspTime; | ||
var timeDiff = noteDSPTime - dspTime; | ||
timeDiff /= Plugin.TimeScale; | ||
var newTime = dspTime + (timeDiff - aheadTime); | ||
_audioSource.PlayScheduled(newTime); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Linq; | ||
using UnityEngine; | ||
using Object = UnityEngine.Object; | ||
|
||
namespace PracticePlugin | ||
{ | ||
public static class NoteHitPitchChanger | ||
{ | ||
private static CustomNoteCutSoundEffect _noteCutSoundEffect; | ||
|
||
public static void ReplacePrefab() | ||
{ | ||
var noteCutSoundEffectManager = Resources.FindObjectsOfTypeAll<NoteCutSoundEffectManager>().FirstOrDefault(); | ||
if (noteCutSoundEffectManager == null) return; | ||
var noteCutSoundEffect = | ||
noteCutSoundEffectManager.GetPrivateField<NoteCutSoundEffect>("_noteCutSoundEffectPrefab"); | ||
var oldNotes = noteCutSoundEffect.GetSpawned(); | ||
foreach (var oldNote in oldNotes) | ||
{ | ||
Object.Destroy(oldNote); | ||
} | ||
noteCutSoundEffect.RecycleAll(); | ||
_noteCutSoundEffect = CustomNoteCutSoundEffect.CopyOriginal(noteCutSoundEffect); | ||
_noteCutSoundEffect.CreatePool(20, | ||
new Action<NoteCutSoundEffect>(noteCutSoundEffectManager.SetCutSoundEffectEventCallbacks)); | ||
noteCutSoundEffectManager.SetPrivateField("_noteCutSoundEffectPrefab", _noteCutSoundEffect); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters