feat: polish game HUD scoring and results
This commit is contained in:
@@ -69,10 +69,10 @@ namespace VRBeats
|
||||
if (audioSource == null)
|
||||
return 0.0f;
|
||||
|
||||
if (hasScheduledClip)
|
||||
return (float)(AudioSettings.dspTime - scheduledDspStartTime);
|
||||
if (hasScheduledClip || scheduledDspStartTime >= 0.0)
|
||||
return Mathf.Max(0.0f, (float)(AudioSettings.dspTime - scheduledDspStartTime));
|
||||
|
||||
return audioSource.time;
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,8 +98,9 @@ namespace VRBeats
|
||||
TrimExpiredSamples(now);
|
||||
BuildRibbon(wideMesh, now, 0f, 1f, trailColor, 0.10f, 0.36f);
|
||||
|
||||
Color coreColor = Color.Lerp(Color.white, trailColor, 0.45f);
|
||||
BuildRibbon(coreMesh, now, 0.42f, 1f, coreColor, 0.14f, 0.48f);
|
||||
Color coreColor = Color.Lerp(Color.white, trailColor, CoreColorWeight(trailColor));
|
||||
float alphaMultiplier = VisibilityAlphaMultiplier(trailColor);
|
||||
BuildRibbon(coreMesh, now, 0.42f, 1f, coreColor, 0.14f * alphaMultiplier, 0.48f * alphaMultiplier);
|
||||
|
||||
lastBase = basePos;
|
||||
lastTip = tipPos;
|
||||
@@ -147,10 +148,11 @@ namespace VRBeats
|
||||
{
|
||||
trailColor = NormalizeColor(color);
|
||||
EnsureRenderers();
|
||||
ApplyMaterialColor(wideMaterial, trailColor, 0.34f);
|
||||
float alphaMultiplier = VisibilityAlphaMultiplier(trailColor);
|
||||
ApplyMaterialColor(wideMaterial, trailColor, 0.34f * alphaMultiplier);
|
||||
|
||||
Color coreColor = Color.Lerp(Color.white, trailColor, 0.45f);
|
||||
ApplyMaterialColor(coreMaterial, coreColor, 0.50f);
|
||||
Color coreColor = Color.Lerp(Color.white, trailColor, CoreColorWeight(trailColor));
|
||||
ApplyMaterialColor(coreMaterial, coreColor, 0.50f * alphaMultiplier);
|
||||
}
|
||||
|
||||
private void ResolveBladeAnchors()
|
||||
@@ -424,6 +426,21 @@ namespace VRBeats
|
||||
return color;
|
||||
}
|
||||
|
||||
private static float CoreColorWeight(Color color)
|
||||
{
|
||||
return IsBlueDominant(color) ? 0.78f : 0.45f;
|
||||
}
|
||||
|
||||
private static float VisibilityAlphaMultiplier(Color color)
|
||||
{
|
||||
return IsBlueDominant(color) ? 1.35f : 1f;
|
||||
}
|
||||
|
||||
private static bool IsBlueDominant(Color color)
|
||||
{
|
||||
return color.b > color.r && color.b >= color.g;
|
||||
}
|
||||
|
||||
private static Color WithAlpha(Color color, float alpha)
|
||||
{
|
||||
color.a = Mathf.Clamp01(alpha);
|
||||
|
||||
@@ -32,8 +32,9 @@ namespace VRBeats
|
||||
tangent = saberUp.sqrMagnitude > 0.001f ? saberUp.normalized : Vector3.right;
|
||||
lift = hitDir.sqrMagnitude > 0.001f ? hitDir.normalized : Vector3.up;
|
||||
|
||||
glowLine = CreateLine("Glow", 0.16f, 0.45f);
|
||||
coreLine = CreateLine("Core", 0.045f, 0.95f);
|
||||
float widthMultiplier = IsBlueDominant(effectColor) ? 1.18f : 1.0f;
|
||||
glowLine = CreateLine("Glow", 0.16f * widthMultiplier, 0.45f);
|
||||
coreLine = CreateLine("Core", 0.045f * widthMultiplier, 0.95f);
|
||||
StartCoroutine(Animate());
|
||||
}
|
||||
|
||||
@@ -67,8 +68,9 @@ namespace VRBeats
|
||||
float bend = Mathf.Lerp(0.12f, 0.34f, t);
|
||||
float alpha = 1.0f - t;
|
||||
|
||||
UpdateLine(glowLine, length, bend, alpha * 0.45f);
|
||||
UpdateLine(coreLine, length * 0.88f, bend * 0.55f, alpha * 0.95f);
|
||||
float alphaMultiplier = VisibilityAlphaMultiplier(effectColor);
|
||||
UpdateLine(glowLine, length, bend, alpha * 0.45f * alphaMultiplier);
|
||||
UpdateLine(coreLine, length * 0.88f, bend * 0.55f, alpha * 0.95f * alphaMultiplier);
|
||||
|
||||
age += Time.deltaTime;
|
||||
yield return null;
|
||||
@@ -136,5 +138,15 @@ namespace VRBeats
|
||||
color.a = 1.0f;
|
||||
return color;
|
||||
}
|
||||
|
||||
private static float VisibilityAlphaMultiplier(Color color)
|
||||
{
|
||||
return IsBlueDominant(color) ? 1.35f : 1.0f;
|
||||
}
|
||||
|
||||
private static bool IsBlueDominant(Color color)
|
||||
{
|
||||
return color.b > color.r && color.b >= color.g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user