mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 11:45:09 +00:00
4c4d0a7a7a
* 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
No EOL
4 KiB
C#
124 lines
No EOL
4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
using HeavenStudio.Games;
|
|
|
|
namespace HeavenStudio.Common
|
|
{
|
|
public class SkillStarManager : MonoBehaviour
|
|
{
|
|
public enum StarState
|
|
{
|
|
None,
|
|
In,
|
|
Collected,
|
|
Out
|
|
}
|
|
public static SkillStarManager instance { get; private set; }
|
|
[SerializeField] private Animator starAnim;
|
|
[SerializeField] private ParticleSystem starParticle;
|
|
|
|
public float StarTargetTime { get { return starStart + starLength; } }
|
|
public bool IsEligible { get; private set; }
|
|
public bool IsCollected { get { return state == StarState.Collected; } }
|
|
|
|
float starStart = float.MaxValue;
|
|
float starLength = float.MaxValue;
|
|
StarState state = StarState.None;
|
|
Conductor cond;
|
|
|
|
// Start is called before the first frame update
|
|
public void Start()
|
|
{
|
|
cond = Conductor.instance;
|
|
instance = this;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (cond.songPositionInBeatsAsDouble > starStart && state == StarState.In)
|
|
{
|
|
double offset = cond.SecsToBeats(Minigame.AceStartTime()-1, cond.GetBpmAtBeat(StarTargetTime));
|
|
if (cond.songPositionInBeatsAsDouble <= starStart + starLength + offset)
|
|
starAnim.DoScaledAnimation("StarIn", starStart, starLength + (float)offset);
|
|
else
|
|
starAnim.Play("StarIn", -1, 1f);
|
|
|
|
offset = cond.SecsToBeats(Minigame.AceEndTime()-1, cond.GetBpmAtBeat(StarTargetTime));
|
|
if (cond.songPositionInBeatsAsDouble > starStart + starLength + offset)
|
|
KillStar();
|
|
}
|
|
}
|
|
|
|
public void DoStarPreview()
|
|
{
|
|
if (starAnim == null) return;
|
|
starAnim.Play("StarJust", -1, 0.5f);
|
|
starAnim.speed = 0f;
|
|
}
|
|
|
|
public void ResetStarPreview()
|
|
{
|
|
if (starAnim == null) return;
|
|
starAnim.Play("NoPose", -1, 0f);
|
|
starAnim.speed = 1f;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
IsEligible = false;
|
|
cond = Conductor.instance;
|
|
state = StarState.None;
|
|
starAnim.Play("NoPose", -1, 0f);
|
|
starAnim.speed = 1f;
|
|
starStart = float.MaxValue;
|
|
starLength = float.MaxValue;
|
|
}
|
|
|
|
public void DoStarIn(float beat, float length)
|
|
{
|
|
if (!OverlaysManager.OverlaysEnabled) return;
|
|
IsEligible = true;
|
|
state = StarState.In;
|
|
starStart = beat;
|
|
starLength = length;
|
|
|
|
TimingAccuracyDisplay.instance.StartStarFlash();
|
|
|
|
starAnim.DoScaledAnimation("StarIn", beat, length);
|
|
}
|
|
|
|
public bool DoStarJust()
|
|
{
|
|
if (state == StarState.In &&
|
|
cond.songPositionInBeatsAsDouble >= StarTargetTime + cond.SecsToBeats(Minigame.AceStartTime()-1, cond.GetBpmAtBeat(StarTargetTime)) &&
|
|
cond.songPositionInBeatsAsDouble <= StarTargetTime + cond.SecsToBeats(Minigame.AceEndTime()-1, cond.GetBpmAtBeat(StarTargetTime))
|
|
)
|
|
{
|
|
state = StarState.Collected;
|
|
starAnim.Play("StarJust", -1, 0f);
|
|
starParticle.Play();
|
|
Jukebox.PlayOneShot("skillStar");
|
|
|
|
TimingAccuracyDisplay.instance.StopStarFlash();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void KillStar()
|
|
{
|
|
if (state == StarState.In && cond.songPositionInBeatsAsDouble >= starStart + starLength*0.5f || !cond.isPlaying)
|
|
{
|
|
IsEligible = false;
|
|
state = StarState.Out;
|
|
starAnim.Play("NoPose", -1, 0f);
|
|
|
|
TimingAccuracyDisplay.instance.StopStarFlash();
|
|
}
|
|
}
|
|
}
|
|
} |