Further input latency fixes

This commit is contained in:
Starpelly 2021-12-24 21:37:03 -05:00
parent 58ea8d5e4c
commit db79325393
7 changed files with 73 additions and 27 deletions

View file

@ -4200,6 +4200,7 @@ GameObject:
m_Component:
- component: {fileID: 992902363}
- component: {fileID: 992902364}
- component: {fileID: 992902365}
m_Layer: 0
m_Name: Circle
m_TagString: Untagged
@ -4272,6 +4273,19 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &992902365
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 992902362}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a761d8a407e1d9d49afaed94b793ed75, type: 3}
m_Name:
m_EditorClassIdentifier:
rotateSpeed: 55
--- !u!1 &1044718271
GameObject:
m_ObjectHideFlags: 0

View file

@ -47,7 +47,7 @@ namespace RhythmHeavenMania
public static Conductor instance;
//Pause times
private int pauseTime = 0;
// private int pauseTime = 0;
public float beatThreshold;

View file

@ -130,7 +130,7 @@ namespace RhythmHeavenMania
}
catch (Exception ex)
{
Debug.LogWarning("Event not found! May be spelled wrong or it is not implemented.");
Debug.LogWarning("Event not found! May be spelled wrong or it is not implemented." + ex);
}
}

View file

@ -88,17 +88,20 @@ namespace RhythmHeavenMania.Games.ClappyTrio
for (int i = 0; i < Lion.Count; i++)
{
float minus = 0;
float length = currentClappingLength * (i);
float lengthplusone = (currentClappingLength * (i + 1));
// i spent like 25 minutes trying to figure out what was wrong with this when i forgot to subtract the currentClapLength :(
if (i == Lion.Count - 1)
minus = Minigame.perfectTime;
{
length = 0;
}
if (songPosBeat > lastClapStart + (currentClappingLength * (i) - minus) && songPosBeat < lastClapStart + (currentClappingLength * (i + 1)) && clapIndex == i)
if (songPosBeat > lastClapStart + length && songPosBeat < lastClapStart + lengthplusone && clapIndex == i)
{
if (i == Lion.Count - 1)
{
ClappyTrioPlayer.SetClapAvailability(lastClapStart + (currentClappingLength * i - Minigame.perfectTime));
ClappyTrioPlayer.SetClapAvailability(lastClapStart + (currentClappingLength * (i - 1)), currentClappingLength);
clapIndex = 0;
isClapping = false;

View file

@ -13,6 +13,7 @@ namespace RhythmHeavenMania.Games.ClappyTrio
public bool late;
private float lastClapBeat;
private float lastClapLength;
[SerializeField] private bool clapVacant;
private int lastIndex;
@ -36,36 +37,47 @@ namespace RhythmHeavenMania.Games.ClappyTrio
Clap();
}
// if (clapVacant == true)
if (clapVacant == true)
{
float normalizedBeat = (Conductor.instance.GetLoopPositionFromBeat(lastClapBeat, 1f));
print(normalizedBeat);
float normalizedBeat = (Conductor.instance.GetLoopPositionFromBeat(lastClapBeat, lastClapLength));
if (normalizedBeat > Minigame.earlyTime && normalizedBeat < Minigame.perfectTime && lastIndex == 0)
if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime() && lastIndex == 0)
{
SetEligibility(true, false, false);
lastIndex++;
}
else if (normalizedBeat > Minigame.perfectTime && normalizedBeat < Minigame.lateTime && lastIndex == 1)
else if (normalizedBeat > Minigame.PerfectTime() && normalizedBeat < Minigame.LateTime() && lastIndex == 1)
{
SetEligibility(false, true, false);
// Clap();
lastIndex++;
}
else if (normalizedBeat > Minigame.lateTime && lastIndex == 2)
else if (normalizedBeat > Minigame.LateTime() && lastIndex == 2)
{
SetEligibility(false, false, true);
clapVacant = false;
lastIndex = 0;
lastClapLength = 0;
lastClapBeat = 0;
hit = false;
ClearLog();
}
}
}
public void SetClapAvailability(float startBeat)
public void ClearLog()
{
var assembly = System.Reflection.Assembly.GetAssembly(typeof(UnityEditor.Editor));
var type = assembly.GetType("UnityEditor.LogEntries");
var method = type.GetMethod("Clear");
method.Invoke(new object(), null);
}
public void SetClapAvailability(float startBeat, float length)
{
lastClapBeat = startBeat;
clapVacant = true;
lastClapLength = length;
}
private void SetEligibility(bool early, bool perfect, bool late)
@ -96,6 +108,7 @@ namespace RhythmHeavenMania.Games.ClappyTrio
}
else
{
print(early + " " + perfect + " " + late);
clapEffect.SetActive(false);
Jukebox.PlayOneShot("miss");
ClappyTrio.instance.playerHitLast = false;

View file

@ -38,43 +38,38 @@ namespace RhythmHeavenMania.Games.ForkLifter
private void Update()
{
float normalizedBeatAnim = (Conductor.instance.GetLoopPositionFromBeat(startBeat, 2.5f));
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, 2.5f);
anim.Play("Flicked_Object", -1, normalizedBeatAnim);
anim.speed = 0;
float normalizedBeat = (Conductor.instance.GetLoopPositionFromBeat(startBeat, 2f));
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, 2f);
float earlyTime = Minigame.earlyTime * 2;
float perfectTime = Minigame.perfectTime * 2;
float lateTime = Minigame.lateTime * 2;
float endTime = Minigame.endTime * 2;
print(normalizedBeat + " " + perfectTime);
print(normalizedBeat + " " + Minigame.PerfectTime());
// Early State
if (normalizedBeat > earlyTime && normalizedBeat < perfectTime && estate <= 1)
if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime() && estate <= 1)
{
MakeEligible(true, false, false);
estate++;
}
// Perfect State
else if (normalizedBeat > perfectTime && normalizedBeat < lateTime && pstate <= 1)
else if (normalizedBeat > Minigame.PerfectTime() && normalizedBeat < Minigame.LateTime() && pstate <= 1)
{
MakeEligible(false, true, false);
pstate++;
}
// Late State
else if (normalizedBeat > lateTime && normalizedBeat < endTime && lstate <= 1)
else if (normalizedBeat > Minigame.LateTime() && normalizedBeat < Minigame.EndTime() && lstate <= 1)
{
MakeEligible(false, false, true);
lstate++;
}
else if (normalizedBeat < earlyTime || normalizedBeat > endTime)
else if (normalizedBeat < Minigame.EarlyTime() || normalizedBeat > Minigame.EndTime())
{
MakeInEligible();
}
if (normalizedBeat > endTime && endstate <= 1)
if (normalizedBeat > Minigame.EndTime() && endstate <= 1)
{
endstate++;
Jukebox.PlayOneShot("audience/disappointed");

View file

@ -6,7 +6,28 @@ namespace RhythmHeavenMania.Games
{
public class Minigame : MonoBehaviour
{
public static float earlyTime = 0.38f, perfectTime = 0.41f, lateTime = 0.535f, endTime = 1f;
public static float earlyTime = 0.77f, perfectTime = 0.87f, lateTime = 1.09f, endTime = 1.15f;
// hopefully these will fix the lowbpm problem
public static float EarlyTime()
{
return earlyTime;
}
public static float PerfectTime()
{
return perfectTime;
}
public static float LateTime()
{
return lateTime;
}
public static float EndTime()
{
return endTime;
}
public int firstEnable = 0;