mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-25 11:05:16 +00:00
commit for sync
auto react, ig
This commit is contained in:
parent
b5cb3f5608
commit
401d3a9386
1 changed files with 23 additions and 13 deletions
|
@ -42,14 +42,15 @@ namespace HeavenStudio.Games.Loaders
|
||||||
preFunction = delegate {
|
preFunction = delegate {
|
||||||
var e = eventCaller.currentEntity;
|
var e = eventCaller.currentEntity;
|
||||||
if (eventCaller.gameManager.TryGetMinigame(out DressYourBest instance)) {
|
if (eventCaller.gameManager.TryGetMinigame(out DressYourBest instance)) {
|
||||||
instance.QueueStartInterval(e.beat, e.length, e["auto"]);
|
instance.QueueStartInterval(e.beat, e.length, e["autoPass"], e["autoReact"]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
defaultLength = 3f,
|
defaultLength = 3f,
|
||||||
resizable = true,
|
resizable = true,
|
||||||
parameters = new List<Param>()
|
parameters = new List<Param>()
|
||||||
{
|
{
|
||||||
new("auto", true, "Auto Pass Turn", "Toggle if the turn should be passed automatically at the end of the start interval.")
|
new("autoPass", true, "Auto Pass Turn", "Toggle if the turn should be passed automatically at the end of the start interval."),
|
||||||
|
new("autoReact", true, "Auto React", "Toggle if the reaction should be on by default."),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new GameAction("monkey call", "Monkey Call")
|
new GameAction("monkey call", "Monkey Call")
|
||||||
|
@ -69,14 +70,14 @@ namespace HeavenStudio.Games.Loaders
|
||||||
preFunction = delegate {
|
preFunction = delegate {
|
||||||
var e = eventCaller.currentEntity;
|
var e = eventCaller.currentEntity;
|
||||||
if (eventCaller.gameManager.TryGetMinigame(out DressYourBest instance)) {
|
if (eventCaller.gameManager.TryGetMinigame(out DressYourBest instance)) {
|
||||||
instance.PassTurn(e.beat);
|
instance.PassTurn(e.beat, e["auto"]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
defaultLength = 1f,
|
defaultLength = 1f,
|
||||||
// parameters = new List<Param>()
|
parameters = new List<Param>()
|
||||||
// {
|
{
|
||||||
// new("auto", true, "Auto Pass Turn", "Toggle if the turn should be passed automatically at the end of the start interval.")
|
new("auto", true, "Auto React", "Toggle if the reaction should be on by default.")
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
new GameAction("background appearance", "Background Appearance")
|
new GameAction("background appearance", "Background Appearance")
|
||||||
{
|
{
|
||||||
|
@ -152,7 +153,6 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
// i set variables to null when they are not initialized by default 👍
|
// i set variables to null when they are not initialized by default 👍
|
||||||
private ColorEase bgColorEase = new(DefaultBGColor);
|
private ColorEase bgColorEase = new(DefaultBGColor);
|
||||||
private Material lightMaterialCurrent;
|
|
||||||
private Sound whirringSfx = null;
|
private Sound whirringSfx = null;
|
||||||
private List<RiqEntity> callEntities;
|
private List<RiqEntity> callEntities;
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
|
|
||||||
// startBeat exists so actions that happened when inactive aren't done again. that would suck
|
// startBeat exists so actions that happened when inactive aren't done again. that would suck
|
||||||
public void QueueStartInterval(double beat, float length, bool auto, double startBeat = double.MinValue)
|
public void QueueStartInterval(double beat, float length, bool autoPass, bool autoReact, double startBeat = double.MinValue)
|
||||||
{
|
{
|
||||||
List<RiqEntity> neededCalls = GetNeededCalls(beat, length);
|
List<RiqEntity> neededCalls = GetNeededCalls(beat, length);
|
||||||
if (neededCalls.Count <= 0) return;
|
if (neededCalls.Count <= 0) return;
|
||||||
|
@ -274,9 +274,9 @@ namespace HeavenStudio.Games
|
||||||
actions.Add(new(call.beat, () => monkeyAnim.DoScaledAnimationAsync("Call", 0.5f)));
|
actions.Add(new(call.beat, () => monkeyAnim.DoScaledAnimationAsync("Call", 0.5f)));
|
||||||
}
|
}
|
||||||
// have to add this after all the other actions as actions are done in order of beat
|
// have to add this after all the other actions as actions are done in order of beat
|
||||||
if (auto) {
|
if (autoPass) {
|
||||||
actions.Add(new(beat + length, delegate {
|
actions.Add(new(beat + length, delegate {
|
||||||
PassTurn(beat + length, beat, length, neededCalls);
|
PassTurn(beat + length, autoReact, beat, length, neededCalls);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
_ = MultiSound.Play(sounds);
|
_ = MultiSound.Play(sounds);
|
||||||
|
@ -284,7 +284,7 @@ namespace HeavenStudio.Games
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PassTurn(double beat, double startIntervalBeat = double.NaN, float startIntervalLength = float.NaN, List<RiqEntity> neededCalls = null)
|
public void PassTurn(double beat, bool autoReact, double startIntervalBeat = double.NaN, float startIntervalLength = float.NaN, List<RiqEntity> neededCalls = null)
|
||||||
{
|
{
|
||||||
if (double.IsNaN(startIntervalBeat) || double.IsNaN(startIntervalLength)) {
|
if (double.IsNaN(startIntervalBeat) || double.IsNaN(startIntervalLength)) {
|
||||||
RiqEntity startInterval = gameManager.Beatmap.Entities.FindLast(e => e.beat + e.length < beat);
|
RiqEntity startInterval = gameManager.Beatmap.Entities.FindLast(e => e.beat + e.length < beat);
|
||||||
|
@ -308,15 +308,25 @@ namespace HeavenStudio.Games
|
||||||
double relativeBeat = call.beat - startIntervalBeat;
|
double relativeBeat = call.beat - startIntervalBeat;
|
||||||
_ = ScheduleInput(beat, relativeBeat + 1, InputAction_BasicPress, OnHit, OnMiss, null);
|
_ = ScheduleInput(beat, relativeBeat + 1, InputAction_BasicPress, OnHit, OnMiss, null);
|
||||||
}
|
}
|
||||||
}
|
if (autoReact) {
|
||||||
|
BeatAction.New(this, new() { new(beat - startIntervalBeat + beat, delegate {
|
||||||
|
|
||||||
|
})});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<RiqEntity> GetNeededCalls(double beat, float length)
|
private List<RiqEntity> GetNeededCalls(double beat, float length)
|
||||||
{
|
{
|
||||||
return callEntities.FindAll(e => e.beat >= beat && e.beat <= beat + length);
|
return callEntities.FindAll(e => e.beat >= beat && e.beat <= beat + length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void IntervalReact()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private int hitCount = 0; // resets every pass turn
|
private int hitCount = 0; // resets every pass turn
|
||||||
|
private bool hasMissed = true;
|
||||||
private void OnHit(PlayerActionEvent caller, float state)
|
private void OnHit(PlayerActionEvent caller, float state)
|
||||||
{
|
{
|
||||||
SoundByte.PlayOneShotGame("dressYourBest/hit_1");
|
SoundByte.PlayOneShotGame("dressYourBest/hit_1");
|
||||||
|
|
Loading…
Reference in a new issue