mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-12-02 14:27:28 +00:00
d5ae99d8ba
* add accuracy display * temp BG for show * separate overlays prefab make proper shader for star effects * aim shakiness display * implement testing skill star * fully functional skill star * separate section display from editor * fully separate chart section display from timeline * add section to overlays * fix nullreference issues * start game layout settings * add game settings script * fix nonfunctioning scoring * invert y position logic on timing bar * add perfect challenge functionality * fix section not showing up in editor add perfect challenge option * add timing display minimal mode * Update PerfectAndPractice.png * show gismo for minigame bounds in editor * add ability to disable overlays in editor * prepare medals add new timing display graphic * hide screen preview * per-axis camera control added per request * section medals basic functionality * add medal get animations * fix bug with perfect icons * visual enhancements * adjust look of timing display minmode address audio ducking issues(?) * prepare overlay lyt editor add viewport pan, rotate, scale adjust audio setting * add layout editor UI elements * dynamic overlay creation * fix default single timing disp * set up overlay settings controls * start UI events * runtime uuid for component reference * layout editor affects overlay elements * show overlay element previews while editing * advanced audio settings * fix bug in drop-down creation * fallback defaults for the new stuff * fix textbox & overlay visibility bugs
172 lines
No EOL
5.9 KiB
C#
172 lines
No EOL
5.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Games;
|
|
|
|
namespace HeavenStudio.Common
|
|
{
|
|
public class TimingAccuracyDisplay : MonoBehaviour
|
|
{
|
|
public enum Rating
|
|
{
|
|
NG,
|
|
OK,
|
|
Just
|
|
}
|
|
|
|
public static TimingAccuracyDisplay instance { get; private set; }
|
|
|
|
[SerializeField] GameObject NG;
|
|
[SerializeField] GameObject OK;
|
|
[SerializeField] GameObject Just;
|
|
[SerializeField] GameObject MinimalJust;
|
|
[SerializeField] GameObject MinimalOK;
|
|
[SerializeField] GameObject MinimalNG;
|
|
|
|
[SerializeField] Animator MetreAnim;
|
|
|
|
[SerializeField] Transform arrowTransform;
|
|
[SerializeField] Transform barTransform;
|
|
[SerializeField] Transform barJustTransform;
|
|
[SerializeField] Transform barOKTransform;
|
|
[SerializeField] Transform barNGTransform;
|
|
|
|
float targetArrowPos = 0f;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
instance = this;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
arrowTransform.localPosition = Vector3.Lerp(arrowTransform.localPosition, new Vector3(0, targetArrowPos, 0), 4f * Time.deltaTime);
|
|
}
|
|
|
|
public void ResetArrow()
|
|
{
|
|
targetArrowPos = 0f;
|
|
arrowTransform.localPosition = Vector3.zero;
|
|
StopStarFlash();
|
|
|
|
NG.GetComponent<ParticleSystem>().Stop();
|
|
OK.GetComponent<ParticleSystem>().Stop();
|
|
Just.GetComponent<ParticleSystem>().Stop();
|
|
MinimalNG.GetComponent<ParticleSystem>().Stop();
|
|
MinimalOK.GetComponent<ParticleSystem>().Stop();
|
|
MinimalJust.GetComponent<ParticleSystem>().Stop();
|
|
}
|
|
|
|
public void StartStarFlash()
|
|
{
|
|
MetreAnim.Play("StarWarn", -1, 0f);
|
|
}
|
|
|
|
public void StopStarFlash()
|
|
{
|
|
MetreAnim.Play("NoPose", -1, 0f);
|
|
}
|
|
|
|
public void MakeAccuracyVfx(double time, bool late = false)
|
|
{
|
|
if (!OverlaysManager.OverlaysEnabled) return;
|
|
GameObject it;
|
|
Rating type = Rating.NG;
|
|
|
|
// centre of the transfor would be "perfect ace"
|
|
// move the object up or down the bar depending on hit time
|
|
// use bar's scale Y for now, we're waiting for proper assets
|
|
|
|
// this probably doesn't work
|
|
float frac = 0f;
|
|
float y = barTransform.position.y;
|
|
|
|
// SetArrowPos(time);
|
|
|
|
// no Clamp() because double
|
|
time = System.Math.Max(Minigame.EarlyTime(), System.Math.Min(Minigame.EndTime(), time));
|
|
|
|
if (time >= Minigame.AceStartTime() && time <= Minigame.AceEndTime())
|
|
{
|
|
type = Rating.Just;
|
|
frac = (float)((time - Minigame.AceStartTime()) / (Minigame.AceEndTime() - Minigame.AceStartTime()));
|
|
y = barJustTransform.localScale.y * frac - (barJustTransform.localScale.y * 0.5f);
|
|
}
|
|
else
|
|
{
|
|
if (time > 1.0)
|
|
{
|
|
// goes "down"
|
|
if (time <= Minigame.LateTime())
|
|
{
|
|
type = Rating.OK;
|
|
frac = (float)((time - Minigame.AceEndTime()) / (Minigame.LateTime() - Minigame.AceEndTime()));
|
|
y = ((barOKTransform.localScale.y - barJustTransform.localScale.y) * frac) + barJustTransform.localScale.y;
|
|
}
|
|
else
|
|
{
|
|
type = Rating.NG;
|
|
frac = (float)((time - Minigame.LateTime()) / (Minigame.EndTime() - Minigame.LateTime()));
|
|
y = ((barNGTransform.localScale.y - barOKTransform.localScale.y) * frac) + barOKTransform.localScale.y;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// goes "up"
|
|
if (time >= Minigame.PerfectTime())
|
|
{
|
|
type = Rating.OK;
|
|
frac = (float)((time - Minigame.PerfectTime()) / (Minigame.AceStartTime() - Minigame.PerfectTime()));
|
|
y = ((barOKTransform.localScale.y - barJustTransform.localScale.y) * -frac) - barJustTransform.localScale.y;
|
|
}
|
|
else
|
|
{
|
|
type = Rating.NG;
|
|
frac = (float)((time - Minigame.EarlyTime()) / (Minigame.PerfectTime() - Minigame.EarlyTime()));
|
|
y = ((barNGTransform.localScale.y - barOKTransform.localScale.y) * -frac) - barOKTransform.localScale.y;
|
|
}
|
|
}
|
|
y *= -0.5f;
|
|
}
|
|
|
|
targetArrowPos = (targetArrowPos + y) * 0.5f;
|
|
|
|
if (PersistentDataManager.gameSettings.timingDisplayMinMode)
|
|
{
|
|
switch (type)
|
|
{
|
|
case Rating.OK:
|
|
it = MinimalOK;
|
|
break;
|
|
case Rating.Just:
|
|
it = MinimalJust;
|
|
break;
|
|
default:
|
|
it = MinimalNG;
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
switch (type)
|
|
{
|
|
case Rating.OK:
|
|
it = OK;
|
|
break;
|
|
case Rating.Just:
|
|
it = Just;
|
|
break;
|
|
default:
|
|
it = NG;
|
|
break;
|
|
}
|
|
}
|
|
|
|
it.transform.position = barTransform.position + new Vector3(0, barTransform.localScale.y * y, 0);
|
|
it.GetComponent<ParticleSystem>().Play();
|
|
}
|
|
}
|
|
} |