mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-26 03:25:22 +00:00
Scoring System Preparation (#235)
* add calculation for accuracy * record accuracy for playthrough * implement forced miss scoring to some games
This commit is contained in:
parent
7dc9aad090
commit
6a61b9d87a
16 changed files with 171 additions and 62 deletions
|
@ -60,6 +60,7 @@ namespace HeavenStudio
|
||||||
public static GameManager instance { get; private set; }
|
public static GameManager instance { get; private set; }
|
||||||
private EventCaller eventCaller;
|
private EventCaller eventCaller;
|
||||||
|
|
||||||
|
// average input accuracy (msec)
|
||||||
List<int> inputOffsetSamples = new List<int>();
|
List<int> inputOffsetSamples = new List<int>();
|
||||||
float averageInputOffset = 0;
|
float averageInputOffset = 0;
|
||||||
public float AvgInputOffset
|
public float AvgInputOffset
|
||||||
|
@ -75,6 +76,18 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// input accuracy (%)
|
||||||
|
double totalInputs = 0;
|
||||||
|
double totalPlayerAccuracy = 0;
|
||||||
|
public double PlayerAccuracy
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (totalInputs == 0) return 0;
|
||||||
|
return totalPlayerAccuracy / totalInputs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
// autoplay = true;
|
// autoplay = true;
|
||||||
|
@ -190,6 +203,14 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ScoreInputAccuracy(double accuracy, bool late, double weight = 1)
|
||||||
|
{
|
||||||
|
totalInputs += weight;
|
||||||
|
totalPlayerAccuracy += accuracy * weight;
|
||||||
|
|
||||||
|
// push the hit event to the timing display
|
||||||
|
}
|
||||||
|
|
||||||
public void SeekAheadAndPreload(double start, float seekTime = 8f)
|
public void SeekAheadAndPreload(double start, float seekTime = 8f)
|
||||||
{
|
{
|
||||||
//seek ahead to preload games that have assetbundles
|
//seek ahead to preload games that have assetbundles
|
||||||
|
@ -369,6 +390,10 @@ namespace HeavenStudio
|
||||||
canInput = true;
|
canInput = true;
|
||||||
inputOffsetSamples.Clear();
|
inputOffsetSamples.Clear();
|
||||||
averageInputOffset = 0;
|
averageInputOffset = 0;
|
||||||
|
|
||||||
|
totalInputs = 0;
|
||||||
|
totalPlayerAccuracy = 0;
|
||||||
|
|
||||||
StartCoroutine(PlayCo(beat));
|
StartCoroutine(PlayCo(beat));
|
||||||
onBeatChanged?.Invoke(beat);
|
onBeatChanged?.Invoke(beat);
|
||||||
}
|
}
|
||||||
|
@ -409,6 +434,7 @@ namespace HeavenStudio
|
||||||
KillAllSounds();
|
KillAllSounds();
|
||||||
|
|
||||||
Debug.Log($"Average input offset for playthrough: {averageInputOffset}ms");
|
Debug.Log($"Average input offset for playthrough: {averageInputOffset}ms");
|
||||||
|
Debug.Log($"Accuracy for playthrough: {(PlayerAccuracy * 100) : 0.00}");
|
||||||
|
|
||||||
if (playOnStart)
|
if (playOnStart)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace HeavenStudio.Games.Scripts_ClappyTrio
|
||||||
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
||||||
{
|
{
|
||||||
Clap(false);
|
Clap(false);
|
||||||
|
game.ScoreMiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,10 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||||
if (stomp == null && cond.isPlaying)
|
if (stomp == null && cond.isPlaying)
|
||||||
{
|
{
|
||||||
if (GameManager.instance.currentGame == "cropStomp")
|
if (GameManager.instance.currentGame == "cropStomp")
|
||||||
|
{
|
||||||
stomp = game.ScheduleUserInput(nextStompBeat - 1f, 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
stomp = game.ScheduleUserInput(nextStompBeat - 1f, 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
||||||
|
stomp.countsForAccuracy = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
||||||
|
@ -52,6 +55,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||||
nextStompBeat += 2f;
|
nextStompBeat += 2f;
|
||||||
stomp?.Disable();
|
stomp?.Disable();
|
||||||
stomp = game.ScheduleUserInput(nextStompBeat - 1f, 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
stomp = game.ScheduleUserInput(nextStompBeat - 1f, 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
||||||
|
stomp.countsForAccuracy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Out(PlayerActionEvent caller) {}
|
private void Out(PlayerActionEvent caller) {}
|
||||||
|
@ -73,6 +77,7 @@ namespace HeavenStudio.Games.Scripts_CropStomp
|
||||||
nextStompBeat += 2f;
|
nextStompBeat += 2f;
|
||||||
stomp?.Disable();
|
stomp?.Disable();
|
||||||
stomp = game.ScheduleUserInput(nextStompBeat - 1f, 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
stomp = game.ScheduleUserInput(nextStompBeat - 1f, 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
||||||
|
stomp.countsForAccuracy = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,6 +232,7 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
student.OnMissHoldForPlayerInput();
|
student.OnMissHoldForPlayerInput();
|
||||||
student.isHolding = true;
|
student.isHolding = true;
|
||||||
|
ScoreMiss();
|
||||||
}
|
}
|
||||||
else if(PlayerInput.PressedUp() && !IsExpectingInputNow() && student.isHolding) //Let go during hold
|
else if(PlayerInput.PressedUp() && !IsExpectingInputNow() && student.isHolding) //Let go during hold
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,6 +102,7 @@ namespace HeavenStudio.Games.Scripts_FanClub
|
||||||
if (!FanClub.instance.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
if (!FanClub.instance.IsExpectingInputNow(InputType.STANDARD_DOWN))
|
||||||
{
|
{
|
||||||
ClapStart(false);
|
ClapStart(false);
|
||||||
|
FanClub.instance.ScoreMiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PlayerInput.Pressing())
|
if (PlayerInput.Pressing())
|
||||||
|
@ -118,6 +119,7 @@ namespace HeavenStudio.Games.Scripts_FanClub
|
||||||
if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && stopCharge && !FanClub.instance.IsExpectingInputNow(InputType.STANDARD_UP))
|
if (clappingStartTime != Single.MinValue && cond.songPositionInBeats > clappingStartTime + 2f && stopCharge && !FanClub.instance.IsExpectingInputNow(InputType.STANDARD_UP))
|
||||||
{
|
{
|
||||||
JumpStart(false);
|
JumpStart(false);
|
||||||
|
FanClub.instance.ScoreMiss();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -152,6 +152,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||||
{
|
{
|
||||||
//start a forced-fail combo sequence
|
//start a forced-fail combo sequence
|
||||||
ForceFailCombo(cond.songPositionInBeats);
|
ForceFailCombo(cond.songPositionInBeats);
|
||||||
|
KarateMan.instance.ScoreMiss(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (PlayerInput.AltPressedUp())
|
else if (PlayerInput.AltPressedUp())
|
||||||
|
|
|
@ -156,6 +156,7 @@ namespace HeavenStudio.Games
|
||||||
var stepPlayerAnim = (beatAnimCheck % 2 != 0 ? "OffbeatMarch" : "OnbeatMarch");
|
var stepPlayerAnim = (beatAnimCheck % 2 != 0 ? "OffbeatMarch" : "OnbeatMarch");
|
||||||
Jukebox.PlayOneShotGame("lockstep/miss");
|
Jukebox.PlayOneShotGame("lockstep/miss");
|
||||||
stepswitcherP.DoScaledAnimationAsync(stepPlayerAnim, 0.5f);
|
stepswitcherP.DoScaledAnimationAsync(stepPlayerAnim, 0.5f);
|
||||||
|
ScoreMiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,7 @@ namespace HeavenStudio.Games
|
||||||
Jukebox.PlayOneShot("miss");
|
Jukebox.PlayOneShot("miss");
|
||||||
Sarge.DoScaledAnimationAsync("Anger", 0.5f);
|
Sarge.DoScaledAnimationAsync("Anger", 0.5f);
|
||||||
Steam.DoScaledAnimationAsync("Steam", 0.5f);
|
Steam.DoScaledAnimationAsync("Steam", 0.5f);
|
||||||
|
ScoreMiss();
|
||||||
|
|
||||||
marchPlayerCount += 1;
|
marchPlayerCount += 1;
|
||||||
var marchPlayerAnim = (marchPlayerCount % 2 != 0 ? "MarchR" : "MarchL");
|
var marchPlayerAnim = (marchPlayerCount % 2 != 0 ? "MarchR" : "MarchL");
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace HeavenStudio.Games
|
||||||
public class Minigame : MonoBehaviour
|
public class Minigame : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static float earlyTime = 0.07f, perfectTime = 0.04f, aceEarlyTime = 0.01f, aceLateTime = 0.01f, lateTime = 0.04f, endTime = 0.07f;
|
public static float earlyTime = 0.07f, perfectTime = 0.04f, aceEarlyTime = 0.01f, aceLateTime = 0.01f, lateTime = 0.04f, endTime = 0.07f;
|
||||||
|
public static float rankHiThreshold = 0.8f, rankOkThreshold = 0.6f;
|
||||||
[SerializeField] public SoundSequence.SequenceKeyValue[] SoundSequences;
|
[SerializeField] public SoundSequence.SequenceKeyValue[] SoundSequences;
|
||||||
|
|
||||||
public List<Minigame.Eligible> EligibleHits = new List<Minigame.Eligible>();
|
public List<Minigame.Eligible> EligibleHits = new List<Minigame.Eligible>();
|
||||||
|
@ -171,7 +172,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public static float AceStartTime()
|
public static float AceStartTime()
|
||||||
{
|
{
|
||||||
return 1f + ScaleTimingMargin(aceEarlyTime);
|
return 1f - ScaleTimingMargin(aceEarlyTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float AceEndTime()
|
public static float AceEndTime()
|
||||||
|
@ -250,6 +251,11 @@ namespace HeavenStudio.Games
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ScoreMiss(double weight = 1f)
|
||||||
|
{
|
||||||
|
GameManager.instance.ScoreInputAccuracy(0, true, weight);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnDestroy() {
|
private void OnDestroy() {
|
||||||
foreach (var evt in scheduledInputs)
|
foreach (var evt in scheduledInputs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,6 +53,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
|
||||||
{
|
{
|
||||||
Jukebox.PlayOneShot("miss");
|
Jukebox.PlayOneShot("miss");
|
||||||
PlayerJump(cond.songPositionInBeats, true, false);
|
PlayerJump(cond.songPositionInBeats, true, false);
|
||||||
|
PajamaParty.instance.ScoreMiss();
|
||||||
}
|
}
|
||||||
if (PlayerInput.AltPressed() && canCharge)
|
if (PlayerInput.AltPressed() && canCharge)
|
||||||
{
|
{
|
||||||
|
@ -62,6 +63,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
|
||||||
{
|
{
|
||||||
Jukebox.PlayOneShot("miss");
|
Jukebox.PlayOneShot("miss");
|
||||||
EndCharge(cond.songPositionInBeats, false, false);
|
EndCharge(cond.songPositionInBeats, false, false);
|
||||||
|
PajamaParty.instance.ScoreMiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
// mako jumping logic
|
// mako jumping logic
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public class PlayerActionEvent : PlayerActionObject
|
public class PlayerActionEvent : PlayerActionObject
|
||||||
{
|
{
|
||||||
|
public static bool EnableAutoplayCheat = false;
|
||||||
public delegate void ActionEventCallback(PlayerActionEvent caller);
|
public delegate void ActionEventCallback(PlayerActionEvent caller);
|
||||||
public delegate void ActionEventCallbackState(PlayerActionEvent caller, float state);
|
public delegate void ActionEventCallbackState(PlayerActionEvent caller, float state);
|
||||||
|
|
||||||
|
@ -33,6 +34,8 @@ namespace HeavenStudio.Games
|
||||||
public InputType inputType; //The type of input. Check the InputType class to see a list of all of them
|
public InputType inputType; //The type of input. Check the InputType class to see a list of all of them
|
||||||
|
|
||||||
public bool perfectOnly = false; //Indicates that the input only recognize perfect inputs.
|
public bool perfectOnly = false; //Indicates that the input only recognize perfect inputs.
|
||||||
|
|
||||||
|
public bool countsForAccuracy = true; //Indicates if the input counts for the accuracy or not. If set to false, it'll not be counted in the accuracy calculation
|
||||||
|
|
||||||
public void setHitCallback(ActionEventCallbackState OnHit)
|
public void setHitCallback(ActionEventCallbackState OnHit)
|
||||||
{
|
{
|
||||||
|
@ -60,31 +63,27 @@ namespace HeavenStudio.Games
|
||||||
if (noAutoplay && autoplayOnly) autoplayOnly = false;
|
if (noAutoplay && autoplayOnly) autoplayOnly = false;
|
||||||
if (noAutoplay && triggersAutoplay){ triggersAutoplay = false; }
|
if (noAutoplay && triggersAutoplay){ triggersAutoplay = false; }
|
||||||
|
|
||||||
float normalizedBeat = GetNormalizedTime();
|
double normalizedTime = GetNormalizedTime();
|
||||||
float stateProg = ((normalizedBeat - Minigame.PerfectTime()) / (Minigame.LateTime() - Minigame.PerfectTime()) - 0.5f) * 2;
|
double stateProg = ((normalizedTime - Minigame.PerfectTime()) / (Minigame.LateTime() - Minigame.PerfectTime()) - 0.5f) * 2;
|
||||||
StateCheck(normalizedBeat);
|
StateCheck(normalizedTime);
|
||||||
|
|
||||||
//BUGFIX: ActionEvents destroyed too early
|
//BUGFIX: ActionEvents destroyed too early
|
||||||
if (normalizedBeat > Minigame.EndTime()) Miss();
|
if (normalizedTime > Minigame.EndTime()) Miss();
|
||||||
|
|
||||||
|
|
||||||
if (IsCorrectInput() && !autoplayOnly)
|
if (IsCorrectInput() && !autoplayOnly)
|
||||||
{
|
{
|
||||||
if (state.perfect)
|
if (state.perfect)
|
||||||
{
|
{
|
||||||
Hit(stateProg);
|
Hit(stateProg, normalizedTime);
|
||||||
if (normalizedBeat >= Minigame.AceStartTime() && normalizedBeat <= Minigame.AceEndTime())
|
|
||||||
{
|
|
||||||
// push an ace event
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (state.early && !perfectOnly)
|
else if (state.early && !perfectOnly)
|
||||||
{
|
{
|
||||||
Hit(-1f);
|
Hit(-1f, normalizedTime);
|
||||||
}
|
}
|
||||||
else if (state.late && !perfectOnly)
|
else if (state.late && !perfectOnly)
|
||||||
{
|
{
|
||||||
Hit(1f);
|
Hit(1f, normalizedTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -95,18 +94,18 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
public bool IsExpectingInputNow()
|
public bool IsExpectingInputNow()
|
||||||
{
|
{
|
||||||
float normalizedBeat = GetNormalizedTime();
|
double normalizedBeat = GetNormalizedTime();
|
||||||
return normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.EndTime();
|
return normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.EndTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetNormalizedTime()
|
double GetNormalizedTime()
|
||||||
{
|
{
|
||||||
var cond = Conductor.instance;
|
var cond = Conductor.instance;
|
||||||
double currTime = cond.GetSongPosFromBeat(cond.songPositionInBeatsAsDouble);
|
double currTime = cond.GetSongPosFromBeat(cond.songPositionInBeatsAsDouble);
|
||||||
double targetTime = cond.GetSongPosFromBeat(startBeat + timer);
|
double targetTime = cond.GetSongPosFromBeat(startBeat + timer);
|
||||||
double min = targetTime - 1f;
|
double min = targetTime - 1f;
|
||||||
double max = targetTime + 1f;
|
double max = targetTime + 1f;
|
||||||
return 1f + (float)(((currTime - min) / (max - min))-0.5f)*2;
|
return 1f + (((currTime - min) / (max - min))-0.5f)*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCorrectInput()
|
public bool IsCorrectInput()
|
||||||
|
@ -138,30 +137,88 @@ namespace HeavenStudio.Games
|
||||||
//For the Autoplay
|
//For the Autoplay
|
||||||
public override void OnAce()
|
public override void OnAce()
|
||||||
{
|
{
|
||||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat,timer);
|
if (EnableAutoplayCheat)
|
||||||
// allows ace detection with this new system
|
{
|
||||||
float stateProg = ((normalizedBeat - Minigame.PerfectTime()) / (Minigame.LateTime() - Minigame.PerfectTime()) - 0.5f) * 2;
|
Hit(0f, 1f);
|
||||||
Hit(stateProg);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double normalizedBeat = GetNormalizedTime();
|
||||||
|
double stateProg = ((normalizedBeat - Minigame.PerfectTime()) / (Minigame.LateTime() - Minigame.PerfectTime()) - 0.5f) * 2;
|
||||||
|
Hit(stateProg, normalizedBeat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//The state parameter is either -1 -> Early, 0 -> Perfect, 1 -> Late
|
//The state parameter is either -1 -> Early, 0 -> Perfect, 1 -> Late
|
||||||
public void Hit(float state)
|
public void Hit(double state, double time)
|
||||||
{
|
{
|
||||||
if (OnHit != null && enabled)
|
if (OnHit != null && enabled)
|
||||||
{
|
{
|
||||||
if(canHit)
|
if(canHit)
|
||||||
{
|
{
|
||||||
float normalized = GetNormalizedTime() - 1f;
|
double normalized = time - 1f;
|
||||||
int offset = Mathf.CeilToInt((float)normalized * 1000);
|
int offset = Mathf.CeilToInt((float)normalized * 1000);
|
||||||
GameManager.instance.AvgInputOffset = offset;
|
GameManager.instance.AvgInputOffset = offset;
|
||||||
OnHit(this, state);
|
OnHit(this, (float) state);
|
||||||
|
|
||||||
CleanUp();
|
CleanUp();
|
||||||
|
if (countsForAccuracy && !(noAutoplay || autoplayOnly))
|
||||||
|
GameManager.instance.ScoreInputAccuracy(TimeToAccuracy(time), time > 1.0, 1.0);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
Blank();
|
Blank();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double TimeToAccuracy(double time)
|
||||||
|
{
|
||||||
|
if (time >= Minigame.AceStartTime() && time <= Minigame.AceEndTime())
|
||||||
|
{
|
||||||
|
// Ace
|
||||||
|
Debug.Log("Accuracy (Ace): " + 1.0);
|
||||||
|
return 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double state = 0;
|
||||||
|
if (time >= Minigame.PerfectTime() && time <= Minigame.LateTime())
|
||||||
|
{
|
||||||
|
// Good Hit
|
||||||
|
if (time > 1.0)
|
||||||
|
{
|
||||||
|
// late half of timing window
|
||||||
|
state = 1.0 - ((time - Minigame.AceEndTime()) / (Minigame.LateTime() - Minigame.AceEndTime()));
|
||||||
|
state *= 1.0 - Minigame.rankHiThreshold;
|
||||||
|
state += Minigame.rankHiThreshold;
|
||||||
|
Debug.Log("Accuracy (Late): " + state);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//early half of timing window
|
||||||
|
state = ((time - Minigame.PerfectTime()) / (Minigame.AceStartTime() - Minigame.PerfectTime()));
|
||||||
|
state *= 1.0 - Minigame.rankHiThreshold;
|
||||||
|
state += Minigame.rankHiThreshold;
|
||||||
|
Debug.Log("Accuracy (Early): " + state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (time > 1.0)
|
||||||
|
{
|
||||||
|
// late half of timing window
|
||||||
|
state = 1.0 - ((time - Minigame.LateTime()) / (Minigame.EndTime() - Minigame.LateTime()));
|
||||||
|
state *= Minigame.rankOkThreshold;
|
||||||
|
Debug.Log("Accuracy (Late NG): " + state);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//early half of timing window
|
||||||
|
state = ((time - Minigame.PerfectTime()) / (Minigame.AceStartTime() - Minigame.PerfectTime()));
|
||||||
|
state *= Minigame.rankOkThreshold;
|
||||||
|
Debug.Log("Accuracy (Early NG): " + state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Miss()
|
public void Miss()
|
||||||
|
@ -172,6 +229,8 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
|
|
||||||
CleanUp();
|
CleanUp();
|
||||||
|
if (countsForAccuracy && !(noAutoplay || autoplayOnly))
|
||||||
|
GameManager.instance.ScoreInputAccuracy(0, true, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Blank()
|
public void Blank()
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace HeavenStudio.Games
|
||||||
autoPlayEnabledOnStart = GameManager.instance.autoplay;
|
autoPlayEnabledOnStart = GameManager.instance.autoplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckForAce(float normalizedBeat, bool autoPlay = false)
|
private void CheckForAce(double normalizedBeat, bool autoPlay = false)
|
||||||
{
|
{
|
||||||
if (aceTimes == 0)
|
if (aceTimes == 0)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
|
|
||||||
// could possibly add support for custom early, perfect, and end times if needed.
|
// could possibly add support for custom early, perfect, and end times if needed.
|
||||||
public void StateCheck(float normalizedBeat, bool autoPlay = false)
|
public void StateCheck(double normalizedBeat, bool autoPlay = false)
|
||||||
{
|
{
|
||||||
CheckForAce(normalizedBeat, autoPlay);
|
CheckForAce(normalizedBeat, autoPlay);
|
||||||
if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime())
|
if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime())
|
||||||
|
|
|
@ -8,23 +8,24 @@ namespace HeavenStudio.Games.Loaders
|
||||||
using static Minigames;
|
using static Minigames;
|
||||||
public static class PcoSomenLoader
|
public static class PcoSomenLoader
|
||||||
{
|
{
|
||||||
public static Minigame AddGame(EventCaller eventCaller) {
|
public static Minigame AddGame(EventCaller eventCaller)
|
||||||
|
{
|
||||||
return new Minigame("rhythmSomen", "Rhythm Sōmen", "99CC34", false, false, new List<GameAction>()
|
return new Minigame("rhythmSomen", "Rhythm Sōmen", "99CC34", false, false, new List<GameAction>()
|
||||||
{
|
{
|
||||||
new GameAction("crane (far)", "Far Crane")
|
new GameAction("crane (far)", "Far Crane")
|
||||||
{
|
{
|
||||||
function = delegate { RhythmSomen.instance.DoFarCrane(eventCaller.currentEntity.beat); },
|
function = delegate { RhythmSomen.instance.DoFarCrane(eventCaller.currentEntity.beat); },
|
||||||
defaultLength = 4.0f,
|
defaultLength = 4.0f,
|
||||||
},
|
},
|
||||||
new GameAction("crane (close)", "Close Crane")
|
new GameAction("crane (close)", "Close Crane")
|
||||||
{
|
{
|
||||||
function = delegate { RhythmSomen.instance.DoCloseCrane(eventCaller.currentEntity.beat); },
|
function = delegate { RhythmSomen.instance.DoCloseCrane(eventCaller.currentEntity.beat); },
|
||||||
defaultLength = 3.0f,
|
defaultLength = 3.0f,
|
||||||
},
|
},
|
||||||
new GameAction("crane (both)", "Both Cranes")
|
new GameAction("crane (both)", "Both Cranes")
|
||||||
{
|
{
|
||||||
function = delegate { RhythmSomen.instance.DoBothCrane(eventCaller.currentEntity.beat); },
|
function = delegate { RhythmSomen.instance.DoBothCrane(eventCaller.currentEntity.beat); },
|
||||||
defaultLength = 4.0f,
|
defaultLength = 4.0f,
|
||||||
},
|
},
|
||||||
new GameAction("offbeat bell", "Offbeat Warning")
|
new GameAction("offbeat bell", "Offbeat Warning")
|
||||||
{
|
{
|
||||||
|
@ -66,14 +67,15 @@ namespace HeavenStudio.Games
|
||||||
var cond = Conductor.instance;
|
var cond = Conductor.instance;
|
||||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
||||||
{
|
{
|
||||||
SomenPlayer.Play("HeadBob", -1, 0);
|
SomenPlayer.Play("HeadBob", -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerInput.Pressed() && !IsExpectingInputNow())
|
if (PlayerInput.Pressed() && !IsExpectingInputNow())
|
||||||
{
|
{
|
||||||
Jukebox.PlayOneShotGame("rhythmSomen/somen_mistake");
|
Jukebox.PlayOneShotGame("rhythmSomen/somen_mistake");
|
||||||
FrontArm.Play("ArmPluck", -1, 0);
|
FrontArm.Play("ArmPluck", -1, 0);
|
||||||
EffectSweat.Play("BlobSweating", -1, 0);
|
EffectSweat.Play("BlobSweating", -1, 0);
|
||||||
|
ScoreMiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +89,7 @@ namespace HeavenStudio.Games
|
||||||
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
||||||
});
|
});
|
||||||
|
|
||||||
BeatAction.New(Player, new List<BeatAction.Action>()
|
BeatAction.New(Player, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
|
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
|
||||||
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}),
|
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}),
|
||||||
|
@ -106,7 +108,7 @@ namespace HeavenStudio.Games
|
||||||
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
||||||
});
|
});
|
||||||
|
|
||||||
BeatAction.New(Player, new List<BeatAction.Action>()
|
BeatAction.New(Player, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
|
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
|
||||||
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}),
|
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}),
|
||||||
|
@ -115,7 +117,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoBothCrane(float beat)
|
public void DoBothCrane(float beat)
|
||||||
{
|
{
|
||||||
//Both Drop Multisound
|
//Both Drop Multisound
|
||||||
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
||||||
|
@ -127,7 +129,7 @@ namespace HeavenStudio.Games
|
||||||
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
||||||
});
|
});
|
||||||
|
|
||||||
BeatAction.New(Player, new List<BeatAction.Action>()
|
BeatAction.New(Player, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
|
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
|
||||||
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
|
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
|
||||||
|
@ -139,33 +141,33 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoBell(float beat)
|
public void DoBell(float beat)
|
||||||
{
|
{
|
||||||
//Bell Sound lol
|
//Bell Sound lol
|
||||||
Jukebox.PlayOneShotGame("rhythmSomen/somen_bell");
|
Jukebox.PlayOneShotGame("rhythmSomen/somen_bell");
|
||||||
|
|
||||||
BeatAction.New(Player, new List<BeatAction.Action>()
|
BeatAction.New(Player, new List<BeatAction.Action>()
|
||||||
{
|
{
|
||||||
new BeatAction.Action(beat, delegate { EffectExclam.Play("ExclamAppear", -1, 0);}),
|
new BeatAction.Action(beat, delegate { EffectExclam.Play("ExclamAppear", -1, 0);}),
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CatchSuccess(PlayerActionEvent caller, float state)
|
public void CatchSuccess(PlayerActionEvent caller, float state)
|
||||||
{
|
{
|
||||||
Jukebox.PlayOneShotGame("rhythmSomen/somen_catch");
|
Jukebox.PlayOneShotGame("rhythmSomen/somen_catch");
|
||||||
FrontArm.Play("ArmPluck", -1, 0);
|
FrontArm.Play("ArmPluck", -1, 0);
|
||||||
EffectHit.Play("HitAppear", -1, 0);
|
EffectHit.Play("HitAppear", -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CatchMiss(PlayerActionEvent caller)
|
public void CatchMiss(PlayerActionEvent caller)
|
||||||
{
|
{
|
||||||
EffectShock.Play("ShockAppear", -1, 0);
|
EffectShock.Play("ShockAppear", -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CatchEmpty(PlayerActionEvent caller)
|
public void CatchEmpty(PlayerActionEvent caller)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -59,7 +59,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers
|
||||||
|
|
||||||
// Auto-release if holding at release time.
|
// Auto-release if holding at release time.
|
||||||
if (normalizedBeat >= 1f)
|
if (normalizedBeat >= 1f)
|
||||||
endEvent.Hit(0f);
|
endEvent.Hit(0f, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
loop.transform.localScale = Vector2.one / holder.transform.localScale;
|
loop.transform.localScale = Vector2.one / holder.transform.localScale;
|
||||||
|
|
|
@ -84,9 +84,9 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai
|
||||||
|
|
||||||
launchProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat, 2f, InputType.STANDARD_ALT_DOWN, LaunchSuccess, LaunchMiss, LaunchThrough);
|
launchProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat, 2f, InputType.STANDARD_ALT_DOWN, LaunchSuccess, LaunchMiss, LaunchThrough);
|
||||||
//autoplay: launch anim
|
//autoplay: launch anim
|
||||||
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat, 2f, InputType.STANDARD_ALT_DOWN, DoLaunchAutoplay, LaunchThrough, LaunchThrough);
|
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat, 2f, InputType.STANDARD_ALT_DOWN, DoLaunchAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false;
|
||||||
//autoplay: unstep
|
//autoplay: unstep
|
||||||
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat, 1.75f, InputType.STANDARD_ALT_UP, DoUnStepAutoplay, LaunchThrough, LaunchThrough);
|
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat, 1.75f, InputType.STANDARD_ALT_UP, DoUnStepAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false;
|
||||||
|
|
||||||
currentCurve = SamuraiSliceNtr.instance.InCurve;
|
currentCurve = SamuraiSliceNtr.instance.InCurve;
|
||||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * startBeat));
|
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * startBeat));
|
||||||
|
@ -216,9 +216,9 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai
|
||||||
{
|
{
|
||||||
flyProg = 2;
|
flyProg = 2;
|
||||||
launchProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 2f, InputType.STANDARD_ALT_DOWN, LaunchSuccess, LaunchMiss, LaunchThrough);
|
launchProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 2f, InputType.STANDARD_ALT_DOWN, LaunchSuccess, LaunchMiss, LaunchThrough);
|
||||||
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 2f, InputType.STANDARD_ALT_DOWN, DoLaunchAutoplay, LaunchThrough, LaunchThrough);
|
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 2f, InputType.STANDARD_ALT_DOWN, DoLaunchAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false;
|
||||||
//autoplay: unstep
|
//autoplay: unstep
|
||||||
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 1.75f, InputType.STANDARD_ALT_UP, DoUnStepAutoplay, LaunchThrough, LaunchThrough);
|
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 1.75f, InputType.STANDARD_ALT_UP, DoUnStepAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false;
|
||||||
currentCurve = null;
|
currentCurve = null;
|
||||||
|
|
||||||
Jukebox.PlayOneShotGame("samuraiSliceNtr/holy_mackerel" + UnityEngine.Random.Range(1, 4), pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 0.8f);
|
Jukebox.PlayOneShotGame("samuraiSliceNtr/holy_mackerel" + UnityEngine.Random.Range(1, 4), pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 0.8f);
|
||||||
|
@ -227,13 +227,13 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai
|
||||||
case (int) SamuraiSliceNtr.ObjectType.Demon:
|
case (int) SamuraiSliceNtr.ObjectType.Demon:
|
||||||
flyProg = 1;
|
flyProg = 1;
|
||||||
hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 4f, InputType.STANDARD_DOWN, HitSuccess, HitMiss, LaunchThrough);
|
hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 4f, InputType.STANDARD_DOWN, HitSuccess, HitMiss, LaunchThrough);
|
||||||
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 4f, InputType.STANDARD_DOWN, DoSliceAutoplay, LaunchThrough, LaunchThrough);
|
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 4f, InputType.STANDARD_DOWN, DoSliceAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false;
|
||||||
currentCurve = SamuraiSliceNtr.instance.LaunchHighCurve;
|
currentCurve = SamuraiSliceNtr.instance.LaunchHighCurve;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
flyProg = 1;
|
flyProg = 1;
|
||||||
hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 2f, InputType.STANDARD_DOWN, HitSuccess, HitMiss, LaunchThrough);
|
hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 2f, InputType.STANDARD_DOWN, HitSuccess, HitMiss, LaunchThrough);
|
||||||
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 2f, InputType.STANDARD_DOWN, DoSliceAutoplay, LaunchThrough, LaunchThrough);
|
SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 2f, InputType.STANDARD_DOWN, DoSliceAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false;
|
||||||
currentCurve = SamuraiSliceNtr.instance.LaunchCurve;
|
currentCurve = SamuraiSliceNtr.instance.LaunchCurve;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,6 +162,7 @@ namespace HeavenStudio.Games
|
||||||
Jukebox.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}");
|
Jukebox.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}");
|
||||||
sweatAnimator.Play("Sweating", 0, 0);
|
sweatAnimator.Play("Sweating", 0, 0);
|
||||||
SummonFrog();
|
SummonFrog();
|
||||||
|
ScoreMiss();
|
||||||
if (!intervalStarted)
|
if (!intervalStarted)
|
||||||
{
|
{
|
||||||
sadFace.SetActive(true);
|
sadFace.SetActive(true);
|
||||||
|
@ -173,6 +174,7 @@ namespace HeavenStudio.Games
|
||||||
Jukebox.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}");
|
Jukebox.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}");
|
||||||
sweatAnimator.Play("Sweating", 0, 0);
|
sweatAnimator.Play("Sweating", 0, 0);
|
||||||
SummonFrog();
|
SummonFrog();
|
||||||
|
ScoreMiss();
|
||||||
if (!intervalStarted)
|
if (!intervalStarted)
|
||||||
{
|
{
|
||||||
sadFace.SetActive(true);
|
sadFace.SetActive(true);
|
||||||
|
|
Loading…
Reference in a new issue