caf7d9465f
* add pause menu assets * layout and animation for pause * make play mode prefab function re-assign unused class inheritance * remove filepath * don't init medals twice * remove PlayerActionObject * initial attempt at anti-note lock TODO: circumvent inputs clearing themselves making the functionality not work * properly implement input lock prevention * fix error on editor open * functional pause menu * bugfix * make unpausing not reset current play statistics * serialize initializer components in inspector instead of procedurally generating * sanity check * note for fade * make flashes in the camera prefabs instead of in world space remove / reorganize script files address issue #411 * fix bug with perfect campaign make minigame transitions hide the game canvas adjust animation of the song credits textbox * fully functional intro scene (placeholder for future title screen) refactored entire game loading procedure re-organized some files * add interaction query to disclaimer text * reword legal * anchor section medals to section display more tempo change placement controls * operation order bugfix * prep for future ratings and stats * loading text * autoload opening scene * splash screen adjustments added setting to force enable splash screen * adjust setting entry
124 lines
3.1 KiB
C#
124 lines
3.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Common
|
|
{
|
|
public class GoForAPerfect : MonoBehaviour
|
|
{
|
|
public static GoForAPerfect instance { get; set; }
|
|
|
|
[SerializeField] Animator texAnim;
|
|
[SerializeField] Animator pAnim;
|
|
|
|
private bool active = false;
|
|
private bool hiddenActive = false;
|
|
|
|
public bool perfect;
|
|
|
|
Conductor cond;
|
|
float lastReportedBeat = 0f;
|
|
float currentBeat = 0f;
|
|
long currentBlink = 0;
|
|
|
|
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
perfect = true;
|
|
cond = Conductor.instance;
|
|
}
|
|
|
|
private void Update() {
|
|
gameObject.SetActive(hiddenActive);
|
|
if (!active) return;
|
|
if (!OverlaysManager.OverlaysEnabled) return;
|
|
if (cond == null || !cond.isPlaying) return;
|
|
|
|
if (cond.ReportBeat(ref lastReportedBeat))
|
|
{
|
|
currentBeat = lastReportedBeat;
|
|
if (currentBlink != 0)
|
|
{
|
|
currentBlink++;
|
|
if (currentBlink % 2 == 0)
|
|
{
|
|
texAnim.Play("GoForAPerfect_Blink", -1, 0);
|
|
}
|
|
else
|
|
{
|
|
texAnim.Play("GoForAPerfect_Blink2", -1, 0);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
currentBlink++;
|
|
}
|
|
}
|
|
else if (cond.songPositionInBeats < lastReportedBeat)
|
|
{
|
|
lastReportedBeat = Mathf.Round(cond.songPositionInBeats);
|
|
}
|
|
}
|
|
|
|
public void Hit()
|
|
{
|
|
if (!active) return;
|
|
if (!OverlaysManager.OverlaysEnabled) return;
|
|
pAnim.Play("PerfectIcon_Hit", 0, 0);
|
|
}
|
|
|
|
public void Miss()
|
|
{
|
|
perfect = false;
|
|
if (!active) return;
|
|
SetInactive();
|
|
if (!OverlaysManager.OverlaysEnabled)
|
|
{
|
|
hiddenActive = false;
|
|
return;
|
|
}
|
|
|
|
texAnim.Play("GoForAPerfect_Miss");
|
|
pAnim.Play("PerfectIcon_Miss", -1, 0);
|
|
Jukebox.PlayOneShot("perfectMiss");
|
|
|
|
if (GameProfiler.instance != null)
|
|
GameProfiler.instance.perfect = false;
|
|
}
|
|
|
|
public void Enable(double startBeat)
|
|
{
|
|
SetActive();
|
|
gameObject.SetActive(true);
|
|
pAnim.gameObject.SetActive(true);
|
|
texAnim.gameObject.SetActive(true);
|
|
texAnim.Play("GoForAPerfect_Idle");
|
|
|
|
currentBlink = 0;
|
|
}
|
|
|
|
public void Disable()
|
|
{
|
|
SetInactive();
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public void SetActive()
|
|
{
|
|
hiddenActive = true;
|
|
active = true;
|
|
}
|
|
public void SetInactive()
|
|
{
|
|
active = false;
|
|
}
|
|
}
|
|
|
|
} |