Marching Orders Rework + Bug Fixes (#442)

* first things first, kill mr. downbeat.

now onto fixing meat grinder forrealzies

* meat grinder fix

* fixed munchy monk icon + mr upbeat ding bug

* a few little changes

* lotta stuff

yeahh just look at the pr description

* point and clap

* anim Adjustment

* new sheet + adjustments for it

* IM USING THE INTERNET

i hate merge conflicts

* grrr merge conflicts

* insane changes

* progress

* fixed The Spaceball Camera Bug (literally a single line of code wtf guys)
* colrs

* k im done :3

---------

Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
This commit is contained in:
AstrlJelly
2023-06-04 00:30:42 -04:00
committed by GitHub
parent bb6559fe58
commit 11044922d3
84 changed files with 19587 additions and 1855 deletions

View File

@ -25,7 +25,7 @@ namespace HeavenStudio
public double songPositionAsDouble => songPos;
// Current song position, in beats
private double songPosBeat; // for Conductor use only
public double songPosBeat; // for Conductor use only
public float songPositionInBeats => (float) songPosBeat;
public double songPositionInBeatsAsDouble => songPosBeat;

View File

@ -454,17 +454,17 @@ namespace HeavenStudio.Games
{
string[] sounds = new string[] { };
if (type == 0)
switch (type)
{
case 0:
sounds = new string[] { "djSchool/scratchoHey1", "djSchool/scratchoHey2", "djSchool/scratchoHey3", "djSchool/scratchoHey4", "djSchool/hey" };
}
else if (type == 1)
{
break;
case 1:
sounds = new string[] { "djSchool/scratchoHeyAlt1", "djSchool/scratchoHeyAlt2", "djSchool/scratchoHeyAlt3", "djSchool/scratchoHeyAlt4", "djSchool/heyAlt" };
}
else if (type == 2)
{
break;
default:
sounds = new string[] { "djSchool/scratchoHeyLoud1", "djSchool/scratchoHeyLoud2", "djSchool/scratchoHeyLoud3", "djSchool/scratchoHeyLoud4", "djSchool/heyLoud" };
break;
}
float timing = 0f;

View File

@ -17,37 +17,30 @@ namespace HeavenStudio.Games.Scripts_DJSchool
UpSecond = 6,
}
[SerializeField] List<Sprite> djYellowHeadSprites = new List<Sprite>();
[SerializeField] SpriteRenderer djYellowHeadSrpite;
[SerializeField] SpriteRenderer djYellowHeadSprite;
float normalXScale;
float negativeXScale;
void Awake()
{
normalXScale = djYellowHeadSrpite.transform.localScale.x;
normalXScale = djYellowHeadSprite.transform.localScale.x;
negativeXScale = -normalXScale;
}
public void ChangeHeadSprite(DJExpression expression)
{
if (expression == DJExpression.UpFirst && HeadSpriteCheck(DJExpression.UpSecond)) return;
djYellowHeadSrpite.sprite = djYellowHeadSprites[(int)expression];
djYellowHeadSprite.sprite = djYellowHeadSprites[(int)expression];
}
public bool HeadSpriteCheck(DJExpression expression)
{
return djYellowHeadSrpite.sprite == djYellowHeadSprites[(int)expression];
return djYellowHeadSprite.sprite == djYellowHeadSprites[(int)expression];
}
public void Reverse(bool should = false)
{
if (should)
{
djYellowHeadSrpite.transform.localScale = new Vector3(negativeXScale, normalXScale, normalXScale);
}
else
{
djYellowHeadSrpite.transform.localScale = new Vector3(normalXScale, normalXScale, normalXScale);
}
djYellowHeadSprite.transform.localScale = new Vector3(should ? negativeXScale : normalXScale, normalXScale, normalXScale);
}
}
}

View File

@ -15,11 +15,8 @@ namespace HeavenStudio.Games.Scripts_DJSchool
public static bool soundFX;
[Header("Properties")]
public float holdBeat;
public float swipeBeat;
public bool isHolding;
public bool shouldBeHolding;
public bool eligible;
public bool missed;
public bool swiping;
bool canBoo = true;
@ -29,7 +26,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
[SerializeField] private GameObject flashFX;
[SerializeField] private GameObject flashFXInverse;
[SerializeField] private GameObject TurnTable;
[SerializeField] private GameObject slamFX;
//[SerializeField] private GameObject slamFX;
AudioMixerGroup mixer;
private Animator tableAnim;
@ -222,7 +219,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
tableAnim.speed = 1;
tableAnim.DoScaledAnimationAsync("Student_Turntable_Swipe", 0.5f);
Instantiate(slamFX, this.transform.parent).SetActive(true);
//Instantiate(slamFX, this.transform.parent).SetActive(true);
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
}
else
@ -238,7 +235,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
tableAnim.speed = 1;
tableAnim.DoScaledAnimationAsync("Student_Turntable_Swipe", 0.5f);
Instantiate(slamFX, this.transform.parent).SetActive(true);
//Instantiate(slamFX, this.transform.parent).SetActive(true);
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
}

View File

@ -125,16 +125,13 @@ namespace HeavenStudio.Games.Scripts_DogNinja
private void Hit(PlayerActionEvent caller, float state)
{
game.DogAnim.SetBool("needPrepare", false);
if (state >= 1f || state <= -1f) {
JustSlice();
} else {
SuccessSlice();
}
if (state >= 1f || state <= -1f) JustSlice();
else SuccessSlice();
}
private void Miss(PlayerActionEvent caller)
{
if (!DogAnim.GetBool("needPrepare")) ;
if (!DogAnim.GetBool("needPrepare")) return;
DogAnim.DoScaledAnimationAsync("UnPrepare", 0.5f);
DogAnim.SetBool("needPrepare", false);
}

View File

@ -11,6 +11,7 @@
// AFTER FEATURE COMPLETION
// - delete all notes once the minigame is considered feature-complete
using HeavenStudio.Common;
using HeavenStudio.Util;
using System;
using System.Collections.Generic;
@ -27,78 +28,137 @@ namespace HeavenStudio.Games.Loaders
{
new GameAction("bop", "Bop")
{
function = delegate { var e = eventCaller.currentEntity; MarchingOrders.instance.BopAction(e.beat, e.length, e["bop"], e["autoBop"]); },
function = delegate { var e = eventCaller.currentEntity; MarchingOrders.instance.BopAction(e.beat, e.length, e["bop"], e["autoBop"], e["clap"]); },
defaultLength = 1f,
resizable = true,
parameters = new List<Param>()
{
new Param("bop", true, "Bop", "Should the cadets bop?"),
new Param("autoBop", false, "Bop (Auto)", "Should the cadets auto bop?")
new Param("autoBop", false, "Bop (Auto)", "Should the cadets auto bop?"),
new Param("clap", false, "Clap", "Should the cadets clap instead of bop?"),
}
},
new GameAction("marching", "Cadets March")
{
preFunction = delegate {
var e = eventCaller.currentEntity;
MarchingOrders.PreMarch(e.beat, e.length);
},
defaultLength = 4f,
resizable = true,
},
new GameAction("attention", "Attention...")
{
function = delegate { var e = eventCaller.currentEntity; MarchingOrders.instance.SargeAttention(e.beat); },
defaultLength = 2f,
preFunction = delegate { var e = eventCaller.currentEntity; MarchingOrders.AttentionSound(e.beat);}
},
new GameAction("march", "March!")
{
function = delegate { var e = eventCaller.currentEntity; MarchingOrders.instance.SargeMarch(e.beat, e["toggle"]); },
function = delegate { var e = eventCaller.currentEntity; MarchingOrders.SargeMarch(e.beat, e["disableVoice"]); },
inactiveFunction = delegate { var e = eventCaller.currentEntity; MarchingOrders.SargeMarch(e.beat, e["disableVoice"]); },
defaultLength = 2f,
parameters = new List<Param>
{
new Param("toggle", false, "Disable Voice", "Disable the Drill Sergeant's call")
new Param("disableVoice", false, "Disable Voice", "Disable the Drill Sergeant's call")
},
inactiveFunction = delegate { var e = eventCaller.currentEntity; MarchingOrders.MarchSound(e.beat, e["toggle"]);}
priority = 5,
},
new GameAction("halt", "Halt!")
new GameAction("faceTurn", "Face Turn")
{
function = delegate { var e = eventCaller.currentEntity; MarchingOrders.instance.SargeHalt(e.beat); },
defaultLength = 2f,
inactiveFunction = delegate { var e = eventCaller.currentEntity; MarchingOrders.HaltSound(e.beat);}
},
new GameAction("face turn", "Direction to Turn")
{
function = delegate { var e = eventCaller.currentEntity; MarchingOrders.instance.SargeFaceTurn(e.beat, e["type"], e["type2"], false); },
function = delegate {
var e = eventCaller.currentEntity;
MarchingOrders.instance.FaceTurn(e.beat, e["direction"], false, e["point"]);
},
defaultLength = 4f,
parameters = new List<Param>()
{
new Param("type", MarchingOrders.DirectionFaceTurn.Right, "Direction", "The direction the sergeant wants the cadets to face"),
new Param("type2", MarchingOrders.FaceTurnLength.Normal, "Length", "The duration of the turning event"),
//new Param("toggle", false, "Point", "Do the pointing animation instead of just the head turn")
new Param("direction", MarchingOrders.Direction.Right, "Direction", "The direction for the cadets to face."),
new Param("point", false, "Point", "Point and face a direction instead of just facing a direction."),
}
},
/*new GameAction("background", "Set the Background") colors aren't implemented yet
new GameAction("faceTurnFast", "Fast Face Turn")
{
function = delegate { var e = eventCaller.currentEntity; MarchingOrders.instance.BackgroundColorSet(e.beat, e["type"], e["type2"], e["colorDefault"], e["colorPipe"], e["colorFloor"], e["colorFill"]); },
function = delegate {
var e = eventCaller.currentEntity;
MarchingOrders.instance.FaceTurn(e.beat, e["direction"], true, e["point"]);
},
defaultLength = 3f,
parameters = new List<Param>()
{
new Param("direction", MarchingOrders.Direction.Right, "Direction", "The direction for the cadets to face."),
new Param("point", false, "Point", "Point and face a direction instead of just facing a direction."),
}
},
new GameAction("halt", "Halt!")
{
function = delegate { MarchingOrders.instance.Halt(eventCaller.currentEntity.beat); },
defaultLength = 2f,
inactiveFunction = delegate { MarchingOrders.HaltSound(eventCaller.currentEntity.beat);}
},
new GameAction("go", "Go!")
{
function = delegate {
var e = eventCaller.currentEntity;
MarchingOrders.instance.MoveConveyor(e.length, e["start"], e["direction"]);
},
parameters = new List<Param>()
{
new Param("start", true, "Start Moving", "Start moving the conveyor"),
new Param("direction", MarchingOrders.Direction.Right, "Direction", "Direction"),
},
defaultLength = 7f,
resizable = true,
},
new GameAction("background", "Background Colors")
{
function = delegate {
var e = eventCaller.currentEntity;
MarchingOrders.instance.BackgroundColorSet(e["preset"], e["colorFill"], e["colorTiles1"], e["colorTiles2"], e["colorTiles3"], e["colorPipes1"], e["colorPipes2"], e["colorPipes3"], e["colorConveyor1"], e["colorConveyor2"]);
},
defaultLength = 0.5f,
parameters = new List<Param>()
{
new Param("type", MarchingOrders.BackgroundColor.Blue, "Color", "The game Background Color"),
new Param("type2", MarchingOrders.BackgroundType.SingleColor, "Color Type", "The way the color is applied to the background"),
new Param("colorDefault", new Color(), "Wall Color", "Sets the color of the wall"),
new Param("colorPipe", new Color(), "Pipes Color", "Sets the color of the pipes"),
new Param("colorFloor", new Color(), "Floor Color", "Sets the color of the floor and conveyer belt"),
new Param("colorFill", new Color(), "Fill Color", "Sets the fill color")
new Param("preset", MarchingOrders.BackgroundColor.Yellow, "Color", "Choose from a preset, or choose custom and set colors below"),
new Param("colorFill", new Color(0.259f, 0.353f, 0.404f), "Wall Color", "Sets the color of the wall"),
new Param("colorTiles1", new Color(1f, 0.76f, 0.52f), "Tile Outline Color", "Sets the color of the tile outline"),
new Param("colorTiles2", new Color(1f, 0.6f, 0.2f), "Tile Shading Color", "Sets the color of the tile shading"),
new Param("colorTiles3", new Color(1f, 0.675f, 0f), "Tile Fill Color", "Sets the color of the tile's main color"),
new Param("colorPipes1", new Color(0.41f, 0.54f, 0.34f), "Pipe Outline Color", "Sets the color of the pipes' outline"),
new Param("colorPipes2", new Color(0.43f, 0.8f, 0.45f), "Pipe Shading Color", "Sets the color of the pipes' shading"),
new Param("colorPipes3", new Color(0.48f, 0.89f, 0.54f), "Pipe Fill Color", "Sets the color of the pipes"),
new Param("colorConveyor1", new Color(0.157f, 0.25f, 0.3f), "Conveyor Fill Color", "Sets the color of the conveyer belt"),
new Param("colorConveyor2", new Color(0.55f, 0.57f, 0.04f), "Conveyor Trim Color", "Sets the conveyor's trim color"),
}
},*/
}, // this cause problems with the background
},
new GameAction("forceMarching", "Force Marching")
{
preFunction = delegate {
var e = eventCaller.currentEntity;
MarchingOrders.instance.ForceMarching(e.beat, e.length);
},
preFunctionLength = 1,
resizable = true,
},
// hidden in the editor but here cuz backwards compatibility
new GameAction("marching", "Start Marching (old)")
{
hidden = false,
preFunction = delegate {
var e = eventCaller.currentEntity;
MarchingOrders.instance.ForceMarching(e.beat, e.length);
},
preFunctionLength = 1,
resizable = true,
},
new GameAction("face turn", "Direction to Turn (old)")
{
hidden = true,
function = delegate {
var e = eventCaller.currentEntity;
MarchingOrders.instance.FaceTurn(e.beat, e["type"], e["type2"], false);
},
defaultLength = 4f,
parameters = new List<Param>()
{
new Param("type", MarchingOrders.Direction.Right, "Direction", "The direction the sergeant wants the cadets to face"),
new Param("type2", MarchingOrders.FaceTurnLength.Normal, "Length", "The duration of the turning event"),
}
},
},
new List<string>() { "agb", "normal" },
"agbmarcher", "en",
new List<string>() { "en", "jp" }
@ -114,413 +174,342 @@ namespace HeavenStudio.Games
{
public static MarchingOrders instance;
[Header("Sarge")]
public Animator Sarge;
public Animator Steam;
static List<float> queuedMarches = new List<float>();
[Header("Cadets")]
public Animator Cadet1;
public Animator Cadet2;
public Animator Cadet3;
public Animator CadetPlayer;
public Animator CadetHead1;
public Animator CadetHead2;
public Animator CadetHead3;
public Animator CadetHeadPlayer;
[Header("Animators")]
[SerializeField] Animator Sarge;
[SerializeField] Animator Steam;
[SerializeField] Animator[] Cadets = new Animator[3];
[SerializeField] Animator[] CadetHeads = new Animator[3];
[SerializeField] Animator CadetPlayer;
[SerializeField] Animator CadetHeadPlayer;
[Header("Background")]
public GameObject BGMain1;
public SpriteRenderer Background;
public SpriteRenderer Pipes;
public SpriteRenderer Floor;
public SpriteRenderer Wall;
public SpriteRenderer Conveyor;
[Header("Colorable")]
[SerializeField] Material[] RecolorMats;
[SerializeField] SpriteRenderer[] BackgroundRecolorable;
static Color BGColor1 = new Color(0.26f, 0.35f, 0.4f), BGColor2 = new Color(0.16f, 0.25f, 0.29f);
[Header("Color Map")]
public static Color pipesColor;
public static Color floorColor;
public static Color wallColor;
public static Color fillColor;
[Header("Objects")]
[SerializeField] ScrollObject[] ConveyorGo;
[Header("Game Events")]
[Header("Variables")]
bool goBop;
public GameEvent bop = new GameEvent();
public GameEvent noBop = new GameEvent();
public GameEvent marching = new GameEvent();
bool shouldClap;
bool keepMarching;
private int marchOtherCount;
private int marchPlayerCount;
private int turnLength;
private int background;
private float steamTime;
static float wantMarch = float.MaxValue;
static float wantMarchLength = 0f;
private float lastMissBeat;
private float lastReportedBeat;
public static float wantMarch = float.MinValue;
public enum DirectionFaceTurn
public enum Direction
{
Right,
Left,
}
public enum FaceTurnLength
{
Normal,
Fast,
}
public enum BackgroundColor
{
Blue,
Yellow,
Blue,
Custom,
}
public enum BackgroundType
{
SingleColor,
DifferentColor
}
// Start is called before the first frame update
void Awake()
{
instance = this;
for (int i = 0; i < BackgroundRecolorable.Length; i++) BackgroundRecolorable[i].color = i == 0 ? BGColor1 : BGColor2;
}
void Update()
{
for (int i = 0; i < BackgroundRecolorable.Length; i++) BackgroundRecolorable[i].color = i == 0 ? BGColor1 : BGColor2;
if (wantMarch != float.MinValue) {
queuedMarches.Add(wantMarch);
marchOtherCount =
marchPlayerCount = 0;
keepMarching = true;
wantMarch = float.MinValue;
}
if (goBop && Conductor.instance.ReportBeat(ref lastReportedBeat)) {
foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync(shouldClap ? "Clap" : "Bop", 0.5f);
CadetPlayer.DoScaledAnimationAsync(shouldClap ? "Clap" : "Bop", 0.5f);
}
if (Conductor.instance.isPlaying && !Conductor.instance.isPaused) {
if (queuedMarches.Count > 0) {
foreach (var march in queuedMarches) {
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(march, delegate {
ScheduleInput(march, 1f, InputType.STANDARD_DOWN, MarchHit, GenericMiss, Empty);
}),
new BeatAction.Action(march + 1, delegate {
marchOtherCount++;
foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync(marchOtherCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f);
Jukebox.PlayOneShotGame("marchingOrders/stepOther");
if (keepMarching) queuedMarches.Add(march + 1);
}),
});
}
queuedMarches.Clear();
}
}
if (ConveyorGo[0].AutoScroll && (ConveyorGo[1].gameObject.transform.position.x < 0)) {
foreach (var scroll in ConveyorGo) scroll.AutoScroll = false;
ConveyorGo[0].gameObject.transform.position = new Vector3(0, 0);
ConveyorGo[1].gameObject.transform.position = new Vector3(6.181f, -3.37f);
}
// input stuff below
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) {
Miss();
marchPlayerCount++;
CadetPlayer.DoScaledAnimationAsync((marchPlayerCount % 2 != 0 ? "MarchR" : "MarchL"), 0.5f);
}
if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN)) {
Miss();
CadetPlayer.DoScaledAnimationAsync("Halt", 0.5f);
}
if (PlayerInput.Pressed(true) && PlayerInput.GetSpecificDirection(PlayerInput.LEFT) && !IsExpectingInputNow(InputType.DIRECTION_LEFT_DOWN)) {
Miss();
CadetHeadPlayer.DoScaledAnimationAsync("FaceL", 0.5f);
}
if (PlayerInput.Pressed(true) && PlayerInput.GetSpecificDirection(PlayerInput.RIGHT) && !IsExpectingInputNow(InputType.DIRECTION_RIGHT_DOWN)) {
Miss();
CadetHeadPlayer.DoScaledAnimationAsync("FaceR", 0.5f);
}
}
public void LeftSuccess(PlayerActionEvent caller, float state)
{
if (state <= -1f || state >= 1f)
{
Jukebox.PlayOneShot("nearNiss");
}
else
Jukebox.PlayOneShotGame("marchingOrders/turnActionPlayer");
CadetHeadPlayer.DoScaledAnimationAsync("FaceL", 0.5f);
TurnSuccess(state, "L");
}
public void RightSuccess(PlayerActionEvent caller, float state)
{
TurnSuccess(state, "R");
}
public void LeftPointSuccess(PlayerActionEvent caller, float state)
{
TurnSuccess(state, "L", true);
}
public void RightPointSuccess(PlayerActionEvent caller, float state)
{
TurnSuccess(state, "R", true);
}
void TurnSuccess(float state, string dir, bool shouldPoint = false)
{
if (state <= -1f || state >= 1f) Jukebox.PlayOneShot("nearMiss");
else Jukebox.PlayOneShotGame("marchingOrders/turnActionPlayer");
CadetHeadPlayer.DoScaledAnimationAsync("Face"+dir, 0.5f);
if (shouldPoint) CadetPlayer.DoScaledAnimationAsync("Point"+dir, 0.5f);
}
public void GenericMiss(PlayerActionEvent caller)
{
if (Conductor.instance.songPositionInBeats - lastMissBeat <= 1.1f) return;
Miss();
}
public void Miss()
{
lastMissBeat = Conductor.instance.songPositionInBeats;
Jukebox.PlayOneShot("miss");
Sarge.DoScaledAnimationAsync("Anger", 0.5f);
Steam.DoScaledAnimationAsync("Steam", 0.5f);
}
public void LeftEmpty(PlayerActionEvent caller) {}
public void RightSuccess(PlayerActionEvent caller, float state)
{
if (state <= -1f || state >= 1f)
{
Jukebox.PlayOneShot("nearNiss");
}
else
Jukebox.PlayOneShotGame("marchingOrders/turnActionPlayer");
CadetHeadPlayer.DoScaledAnimationAsync("FaceR", 0.5f);
}
public void RightEmpty(PlayerActionEvent caller) {}
public void MarchHit(PlayerActionEvent caller, float state)
{
if (state <= -1f || state >= 1f)
{
Jukebox.PlayOneShot("nearNiss");
}
else
Jukebox.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f);
if (state <= -1f || state >= 1f) Jukebox.PlayOneShot("nearMiss");
else Jukebox.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f);
marchPlayerCount++;
CadetPlayer.DoScaledAnimationAsync(marchPlayerCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f);
}
public void MarchEmpty(PlayerActionEvent caller) {}
public void HaltHit(PlayerActionEvent caller, float state)
{
if (state <= -1f || state >= 1f)
{
Jukebox.PlayOneShot("nearNiss");
}
else
Jukebox.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f);
if (state <= -1f || state >= 1f) Jukebox.PlayOneShot("nearMiss");
else Jukebox.PlayOneShotGame("marchingOrders/stepPlayer", volume: 0.25f);
CadetPlayer.DoScaledAnimationAsync("Halt", 0.5f);
}
public void HaltEmpty(PlayerActionEvent caller) {}
// Update is called once per frame
void Update()
{
var cond = Conductor.instance;
var currBeat = cond.songPositionInBeats;
if (cond.songPositionInBeatsAsDouble >= wantMarch)
{
PrepareMarch(wantMarch, wantMarchLength, true);
wantMarch = float.MaxValue;
}
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1, true))
{
if (goBop)
{
Cadet1.DoScaledAnimationAsync("Bop", 0.5f);
Cadet2.DoScaledAnimationAsync("Bop", 0.5f);
Cadet3.DoScaledAnimationAsync("Bop", 0.5f);
CadetPlayer.DoScaledAnimationAsync("Bop", 0.5f);
}
}
if (!IsExpectingInputNow(InputType.STANDARD_DOWN))
{
if (PlayerInput.Pressed())
{
Jukebox.PlayOneShot("miss");
Sarge.DoScaledAnimationAsync("Anger", 0.5f);
Steam.DoScaledAnimationAsync("Steam", 0.5f);
marchPlayerCount++;
var marchPlayerAnim = (marchPlayerCount % 2 != 0 ? "MarchR" : "MarchL");
CadetPlayer.DoScaledAnimationAsync(marchPlayerAnim, 0.5f);
}
}
if (!IsExpectingInputNow(InputType.STANDARD_ALT_DOWN))
{
if (PlayerInput.AltPressed())
{
Jukebox.PlayOneShot("miss");
Sarge.DoScaledAnimationAsync("Anger", 0.5f);
Steam.DoScaledAnimationAsync("Steam", 0.5f);
CadetPlayer.DoScaledAnimationAsync("Halt", 0.5f);
}
}
if (!IsExpectingInputNow(InputType.DIRECTION_LEFT_DOWN))
{
if (PlayerInput.Pressed(true) && PlayerInput.GetSpecificDirection(PlayerInput.LEFT))
{
Jukebox.PlayOneShot("miss");
Sarge.DoScaledAnimationAsync("Anger", 0.5f);
Steam.DoScaledAnimationAsync("Steam", 0.5f);
CadetHeadPlayer.DoScaledAnimationAsync("FaceL", 0.5f);
}
}
if (!IsExpectingInputNow(InputType.DIRECTION_RIGHT_DOWN))
{
if (PlayerInput.Pressed(true) && PlayerInput.GetSpecificDirection(PlayerInput.RIGHT))
{
Jukebox.PlayOneShot("miss");
Sarge.DoScaledAnimationAsync("Anger", 0.5f);
Steam.DoScaledAnimationAsync("Steam", 0.5f);
CadetHeadPlayer.DoScaledAnimationAsync("FaceR", 0.5f);
}
}
}
public void BopAction(float beat, float length, bool shouldBop, bool autoBop)
public void BopAction(float beat, float length, bool shouldBop, bool autoBop, bool clap)
{
goBop = autoBop;
if (shouldBop)
{
for (int i = 0; i < length; i++)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + i, delegate
{
Cadet1.DoScaledAnimationAsync("Bop", 0.5f);
Cadet2.DoScaledAnimationAsync("Bop", 0.5f);
Cadet3.DoScaledAnimationAsync("Bop", 0.5f);
CadetPlayer.DoScaledAnimationAsync("Bop", 0.5f);
shouldClap = clap;
if (shouldBop) {
for (int i = 0; i < length; i++) {
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat + i, delegate {
foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync(shouldClap ? "Clap" : "Bop", 0.5f);
CadetPlayer.DoScaledAnimationAsync(shouldClap ? "Clap" : "Bop", 0.5f);
})
});
}
}
}
public static void PreMarch(float beat, float length)
{
wantMarch = beat - 1;
wantMarchLength = length;
}
public void PrepareMarch(float beat, float length = 0, bool first = false)
{
if (GameManager.instance.currentGame != "marchingOrders")
return;
if (first)
{
marching.length = length;
marching.startBeat = beat + 1;
marchOtherCount = 0;
marchPlayerCount = 0;
}
else
{
marchOtherCount++;
Cadet1.DoScaledAnimationAsync(marchOtherCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f);
Cadet2.DoScaledAnimationAsync(marchOtherCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f);
Cadet3.DoScaledAnimationAsync(marchOtherCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f);
}
if (beat + 1 < marching.startBeat + marching.length)
{
Debug.Log($"PrepareMarch next {beat + 1}, {marching.startBeat}, {marching.length}");
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 1f, delegate {
PrepareMarch(beat + 1);
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("marchingOrders/stepOther", beat + 1),
}, true);
}),
});
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, MarchHit, GenericMiss, MarchEmpty);
}
}
public void SargeAttention(float beat)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 0.25f, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}),
BeatAction.New(gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat + 0.25f, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}),
});
}
public void SargeMarch(float beat, bool noVoice)
public static void SargeMarch(float beat, bool noVoice)
{
marchOtherCount = 0;
marchPlayerCount = 0;
MarchSound(beat, noVoice);
if (MarchingOrders.wantMarch != float.MinValue) return;
MarchingOrders.wantMarch = beat + 1;
if (!noVoice)
Sarge.DoScaledAnimationAsync("Talk", 0.5f);
if (!noVoice) PlaySoundSequence("marchingOrders", "susume", beat);
if (GameManager.instance.currentGame == "marchingOrders") {
MarchingOrders.instance.PreMarch(beat);
if (!noVoice) MarchingOrders.instance.Sarge.DoScaledAnimationAsync("Talk", 0.5f);
}
}
public void ForceMarching(float beat, float length)
{
for (int i = 0; i < length; i++) {
ScheduleInput(beat + i - 1, 1f, InputType.STANDARD_DOWN, MarchHit, GenericMiss, Empty);
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat + i, delegate {
marchOtherCount++;
foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync(marchOtherCount % 2 != 0 ? "MarchR" : "MarchL", 0.5f);
Jukebox.PlayOneShotGame("marchingOrders/stepOther");
}),
});
}
}
public void PreMarch(float beat)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 1f, delegate { Cadet1.DoScaledAnimationAsync("MarchL", 0.5f);}),
new BeatAction.Action(beat + 1f, delegate { Cadet2.DoScaledAnimationAsync("MarchL", 0.5f);}),
new BeatAction.Action(beat + 1f, delegate { Cadet3.DoScaledAnimationAsync("MarchL", 0.5f);}),
new BeatAction.Action(beat + 1f, delegate { CadetPlayer.DoScaledAnimationAsync("MarchL", 0.5f);}),
new BeatAction.Action(beat + 1f, delegate {
foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync("MarchL", 0.5f);
CadetPlayer.DoScaledAnimationAsync("MarchL", 0.5f);
}),
});
}
public void SargeHalt(float beat)
public void Halt(float beat)
{
keepMarching = false;
HaltSound(beat);
ScheduleInput(beat, 1f, InputType.STANDARD_ALT_DOWN, HaltHit, GenericMiss, HaltEmpty);
ScheduleInput(beat, 1f, InputType.STANDARD_ALT_DOWN, HaltHit, GenericMiss, Empty);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}),
new BeatAction.Action(beat + 1f, delegate { Cadet1.DoScaledAnimationAsync("Halt", 0.5f);}),
new BeatAction.Action(beat + 1f, delegate { Cadet2.DoScaledAnimationAsync("Halt", 0.5f);}),
new BeatAction.Action(beat + 1f, delegate { Cadet3.DoScaledAnimationAsync("Halt", 0.5f);}),
new BeatAction.Action(beat, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}),
new BeatAction.Action(beat + 1f, delegate { foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync("Halt", 0.5f);}),
});
}
public void SargeFaceTurn(float beat, int type, int type2, bool toggle)
public void FaceTurn(float beat, int direction, bool isFast, bool shouldPoint)
{
string fastTurn = "";
switch (type2)
{
case (int) MarchingOrders.FaceTurnLength.Fast:
turnLength = 0;
fastTurn = "fast";
break;
default:
turnLength = 1;
fastTurn = "";
break;
}
// x is true if the direction is right
bool x = (direction == 0);
int turnLength = (isFast ? 0 : 1);
ScheduleInput(beat, turnLength + 2f, x ? InputType.DIRECTION_RIGHT_DOWN : InputType.DIRECTION_LEFT_DOWN, x ? (shouldPoint ? RightPointSuccess : RightSuccess) : (shouldPoint ? LeftPointSuccess : LeftSuccess), GenericMiss, Empty);
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound($"marchingOrders/{(x ? "right" : "left")}FaceTurn1{(isFast ? "fast" : "")}", beat),
new MultiSound.Sound($"marchingOrders/{(x ? "right" : "left")}FaceTurn2{(isFast ? "fast" : "")}", beat + 0.5f),
new MultiSound.Sound($"marchingOrders/{(x ? "right" : "left")}FaceTurn3", beat + turnLength + 1f),
new MultiSound.Sound("marchingOrders/turnAction", beat + turnLength + 2f),
}, forcePlay: true);
switch (type)
{
case (int) MarchingOrders.DirectionFaceTurn.Left:
ScheduleInput(beat, turnLength + 2f, InputType.DIRECTION_LEFT_DOWN, LeftSuccess, GenericMiss, LeftEmpty);
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("marchingOrders/leftFaceTurn1" + fastTurn, beat),
new MultiSound.Sound("marchingOrders/leftFaceTurn2" + fastTurn, beat + 0.5f),
new MultiSound.Sound("marchingOrders/leftFaceTurn3", beat + turnLength + 1f),
new MultiSound.Sound("marchingOrders/turnAction", beat + turnLength + 2f),
}, forcePlay: true);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + turnLength + 2f, delegate { if (!toggle) CadetHead1.DoScaledAnimationAsync("FaceL", 0.5f);
else Cadet1.DoScaledAnimationAsync("PointL"); }),
new BeatAction.Action(beat + turnLength + 2f, delegate { if (!toggle) CadetHead2.DoScaledAnimationAsync("FaceL", 0.5f);
else Cadet2.DoScaledAnimationAsync("PointL");}),
new BeatAction.Action(beat + turnLength + 2f, delegate { if (!toggle) CadetHead3.DoScaledAnimationAsync("FaceL", 0.5f);
else Cadet3.DoScaledAnimationAsync("PointL");}),
});
break;
default:
ScheduleInput(beat, turnLength + 2f, InputType.DIRECTION_RIGHT_DOWN, RightSuccess, GenericMiss, RightEmpty);
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound("marchingOrders/rightFaceTurn1" + fastTurn, beat),
new MultiSound.Sound("marchingOrders/rightFaceTurn2" + fastTurn, beat + 0.5f),
new MultiSound.Sound("marchingOrders/rightFaceTurn3", beat + turnLength + 1f),
new MultiSound.Sound("marchingOrders/turnAction", beat + turnLength + 2f),
}, forcePlay: true);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + turnLength + 2f, delegate { if (!toggle) CadetHead1.DoScaledAnimationAsync("FaceR", 0.5f);
else Cadet1.DoScaledAnimationAsync("PointR");}),
new BeatAction.Action(beat + turnLength + 2f, delegate { if (!toggle) CadetHead2.DoScaledAnimationAsync("FaceR", 0.5f);
else Cadet2.DoScaledAnimationAsync("PointR");}),
new BeatAction.Action(beat + turnLength + 2f, delegate { if (!toggle) CadetHead3.DoScaledAnimationAsync("FaceR", 0.5f);
else Cadet3.DoScaledAnimationAsync("PointR");}),
});
break;
}
BeatAction.New(gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat + turnLength + 2f,delegate {
if (shouldPoint) foreach (var cadet in Cadets) cadet.DoScaledAnimationAsync($"Point{(x ? "R" : "L")}", 0.5f);
foreach (var head in CadetHeads) head.DoScaledAnimationAsync($"Face{(x ? "R" : "L")}", 0.5f);
})
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}),
new BeatAction.Action(beat + turnLength + 1f, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}),
new BeatAction.Action(beat, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}),
new BeatAction.Action(beat + turnLength + 1f, delegate { Sarge.DoScaledAnimationAsync("Talk", 0.5f);}),
});
}
/*public void BackgroundColorSet(float beat, int type, int colorType, Color wall, Color pipes, Color floor, Color fill)
public void BackgroundColorSet(int preset, Color fill, Color tiles1, Color tiles2, Color tiles3, Color pipes1, Color pipes2, Color pipes3, Color conveyor1, Color conveyor2)
{
background = type;
if (colorType == (int) MarchingOrders.BackgroundColor.Custom)
{
pipesColor = pipes;
floorColor = floor;
wallColor = wall;
fillColor = fill;
if (preset == 2) UpdateMaterialColor(fill, tiles1, tiles2, tiles3, pipes1, pipes2, pipes3, conveyor1, conveyor2);
else {
bool x = preset == 0;
UpdateMaterialColor(
x ? new Color(0.26f, 0.36f, 0.39f) : new Color(0.25f, 0.45f, 0.52f),
x ? new Color(1f, 0.76f, 0.52f) : new Color(0.45f, 0.71f, 0.81f),
x ? new Color(1f, 0.6f, 0.2f) : new Color(0.65f, 0.87f, 0.94f),
x ? new Color(1f, 0.68f, 0f) : new Color(0.65f, 0.87f, 0.94f),
x ? new Color(0.41f, 0.54f, 0.34f) : new Color(0.36f, 0.58f, 0.64f),
x ? new Color(0.43f, 0.8f, 0.45f) : new Color(0.48f, 0.65f, 0.71f),
x ? new Color(0.48f, 0.89f, 0.54f) : new Color(0.48f, 0.65f, 0.71f),
x ? new Color(0.16f, 0.25f, 0.3f) : new Color(0.32f, 0.55f, 0.62f),
x ? new Color(0.55f, 0.57f, 0.04f) : new Color(0.17f, 0.31f, 0.35f)
);
}
Pipes.color = pipesColor;
UpdateMaterialColour(pipes, floor, wall);
}
public static void UpdateMaterialColour(Color mainCol, Color highlightCol, Color objectCol)
public void UpdateMaterialColor(Color fill, Color tiles1, Color tiles2, Color tiles3, Color pipes1, Color pipes2, Color pipes3, Color conveyor1, Color conveyor2)
{
pipesColor = mainCol;
floorColor = highlightCol;
wallColor = objectCol;
}*/
BGColor1 = fill;
BGColor2 = conveyor1;
Recolor(0, tiles3, tiles2, tiles1);
Recolor(1, pipes2, pipes1, pipes3);
Recolor(2, new Color(0, 0, 0), conveyor1, conveyor2);
void Recolor(int i, Color color1, Color color2, Color color3) {
RecolorMats[i].SetColor("_ColorAlpha", color1);
RecolorMats[i].SetColor("_ColorBravo", color2);
RecolorMats[i].SetColor("_ColorDelta", color3);
}
}
public static void AttentionSound(float beat)
{
PlaySoundSequence("marchingOrders", "zentai", beat - 1);
}
public static void MarchSound(float beat, bool noVoice)
{
if (!noVoice)
{
PlaySoundSequence("marchingOrders", "susume", beat);
}
}
public static void HaltSound(float beat)
{
PlaySoundSequence("marchingOrders", "tomare", beat);
}
public void MoveConveyor(float length, bool go, int direction)
{
foreach (var scroll in ConveyorGo) {
scroll.SpeedMod = ((direction == 0 ? 20 : -20)/length)*(Conductor.instance.songBpm/100);
scroll.AutoScroll = go;
}
}
static void Empty(PlayerActionEvent caller) { }
}
}

View File

@ -40,7 +40,7 @@ namespace HeavenStudio.Games.Loaders
{
defaultLength = 4f,
resizable = true,
priority = 1,
priority = 5,
preFunction = delegate {
var e = eventCaller.currentEntity;
MeatGrinder.PreInterval(e.beat, e.length);
@ -58,7 +58,7 @@ namespace HeavenStudio.Games.Loaders
new Param("bossBop", false, "Boss Bops? (Auto)", "Does Boss Auto bop?"),
},
resizable = true,
priority = 4,
priority = 1,
},
},
new List<string>() {"pco", "normal", "repeat"},
@ -93,7 +93,6 @@ namespace HeavenStudio.Games
bool intervalStarted;
float intervalStartBeat;
bool bossBop = true;
bool hasSignaled;
public float beatInterval = 4f;
public bool bossAnnoyed = false;
private float lastReportedBeat = 0f;
@ -118,6 +117,7 @@ namespace HeavenStudio.Games
if (queuedInputs.Count > 0) queuedInputs.Clear();
if (queuedIntervals.Count > 0) queuedIntervals.Clear();
intervalStarted = false;
beatInterval = 4f;
}
foreach (var evt in scheduledInputs)
{
@ -127,17 +127,7 @@ namespace HeavenStudio.Games
private void Update()
{
if (!Conductor.instance.isPlaying || Conductor.instance.isPaused) {
if (queuedInputs.Count > 0) queuedInputs.Clear();
}
if (!Conductor.instance.NotStopped()) {
intervalStarted = false;
beatInterval = 4f;
}
if (PlayerInput.Pressed(true) && !IsExpectingInputNow(InputType.STANDARD_DOWN)) {
ScoreMiss();
if (PlayerInput.Pressed(true) && (!IsExpectingInputNow(InputType.STANDARD_DOWN) || !IsExpectingInputNow(InputType.DIRECTION_DOWN))) {
TackAnim.DoScaledAnimationAsync("TackEmptyHit", 0.5f);
TackAnim.SetBool("tackMeated", false);
Jukebox.PlayOneShotGame(sfxName+"whiff");
@ -160,24 +150,19 @@ namespace HeavenStudio.Games
&& bossBop)
{
BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f);
};
}
}
public void Bop(float beat, float length, bool doesBop, bool autoBop)
{
bossBop = autoBop;
if (doesBop)
{
for (int i = 0; i < length; i++)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + i, delegate
{
if (!BossAnim.IsPlayingAnimationName("BossCall") && !BossAnim.IsPlayingAnimationName("BossSignal"))
{
if (doesBop) {
for (int i = 0; i < length; i++) {
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat + i, delegate {
if (!BossAnim.IsPlayingAnimationName("BossCall") && !BossAnim.IsPlayingAnimationName("BossSignal")) {
BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f);
};
}
})
});
}
@ -235,17 +220,13 @@ namespace HeavenStudio.Games
BossAnim.DoScaledAnimationAsync("BossCall", 0.5f);
Jukebox.PlayOneShotGame(sfxName+"signal");
if (!intervalStarted)
{
StartInterval(beat, beatInterval);
}
StartInterval(beat, beatInterval);
queuedInputs.Add(beat - intervalStartBeat);
}
public void PassTurn(float beat)
{
hasSignaled = false;
intervalStarted = false;
foreach (var input in queuedInputs)
{

View File

@ -13,7 +13,6 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
public float cueLength;
public bool cueBased;
public string meatType;
bool animCheck;
[Header("Animators")]
private Animator anim;
@ -39,14 +38,7 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
private void Update()
{
if (GameManager.instance.currentGame != "meatGrinder") {
GameObject.Destroy(gameObject);
}
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused) {
GameObject.Destroy(gameObject);
}
if (anim.IsAnimationNotPlaying() && animCheck) GameObject.Destroy(gameObject);
if (anim.IsPlayingAnimationName("DarkIdle") || anim.IsPlayingAnimationName("LightIdle")) GameObject.Destroy(gameObject);
}
private void InputActions(bool annoyBoss, string whichSfx, string whichAnim)
@ -60,7 +52,6 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
{
game.TackAnim.SetBool("tackMeated", false);
anim.DoScaledAnimationAsync(meatType+"Hit", 0.5f);
animCheck = true;
if (state >= 1f || state <= -1f) {
InputActions(true, "tink", "TackHitBarely");

View File

@ -13,36 +13,38 @@ namespace HeavenStudio.Games.Loaders
public static class AgbUpbeatLoader
{
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("mrUpbeat", "Mr. Upbeat", "ffffff", false, false, new List<GameAction>()
return new Minigame("mrUpbeat", "Mr. Upbeat", "E0E0E0", false, false, new List<GameAction>()
{
new GameAction("start stepping", "Start Stepping")
new GameAction("prepare", "Prepare")
{
preFunction = delegate {var e = eventCaller.currentEntity; MrUpbeat.StartStepping(e.beat, e.length, e["force"]); },
preFunction = delegate {
var e = eventCaller.currentEntity;
MrUpbeat.StartStepping(e.beat, e.length);
},
defaultLength = 4f,
resizable = true,
parameters = new List<Param>()
{
new Param("force", false, "Force Mr. Downbeat", "Forces inputs to not be only on the offbeats"),
}
},
new GameAction("ding", "Ding!")
{
function = delegate {
preFunction = delegate {
var e = eventCaller.currentEntity;
MrUpbeat.instance.Ding(eventCaller.currentEntity["toggle"], e["stopBlipping"]); },
MrUpbeat.Ding(e.beat, e["toggle"], e["stopBlipping"]);
},
defaultLength = 0.5f,
parameters = new List<Param>()
{
new Param("toggle", false, "Applause", "Plays an applause sound effect."),
new Param("stopBlipping", true, "Stop Blipping?", "When the stepping stops, should the blipping stop too?"),
}
},
preFunctionLength = 1f,
},
new GameAction("changeBG", "Change Background Color")
{
function = delegate {
var e = eventCaller.currentEntity;
MrUpbeat.instance.FadeBackgroundColor(e["start"], e["end"], e.length, e["toggle"]); },
defaultLength = 1f,
MrUpbeat.instance.FadeBackgroundColor(e["start"], e["end"], e.length, e["toggle"]);
},
resizable = true,
parameters = new List<Param>()
{
@ -75,11 +77,39 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>()
{
new Param("letter", "", "Letter To Appear", "Which letter to appear on the blip"),
new Param("shouldGrow", true, "Grow Antenna?", "Should Mr. Upbeat's antenna grow?"),
new Param("shouldGrow", true, "Grow Antenna?", "Should Mr. Upbeat's antenna grow every blip?"),
new Param("resetBlip", false, "Reset Antenna?", "Should Mr. Upbeat's antenna reset?"),
new Param("blip", true, "Should Blip?", "Should Mr. Upbeat blip every offbeat?"),
}
},
// will implement these soon
new GameAction("fourBeatCountInOffbeat", "4 Beat Count-In")
{
preFunction = delegate {
var e = eventCaller.currentEntity;
//MrUpbeat.CountIn(e.beat, e.length);
},
defaultLength = 4f,
resizable = true,
hidden = true,
},
new GameAction("countOffbeat", "4 Beat Count-In")
{
//function = delegate { MrUpbeat.Count(eventCaller.currentEntity["number"]); },
parameters = new List<Param>()
{
new Param("number", SoundEffects.CountNumbers.One, "Number", "The sound to play"),
},
hidden = true,
},
// backwards compatibility !!!!
new GameAction("start stepping", "Start Stepping")
{
hidden = true,
preFunction = delegate {var e = eventCaller.currentEntity; MrUpbeat.StartStepping(e.beat, e.length); },
resizable = true,
},
},
new List<string>() {"agb", "keep"},
"agboffbeat", "en",
@ -107,15 +137,16 @@ namespace HeavenStudio.Games
[Header("Properties")]
private Tween bgColorTween;
public int stepIterate = 0;
public static float downbeatMod = 0.5f;
public static bool shouldBlip;
static bool noDing;
static bool isStepping;
static bool shouldntStop;
public static MrUpbeat instance;
private void Awake()
{
instance = this;
isStepping = false;
blipMaterial.SetColor("_ColorBravo", new Color(0, 1f, 0));
}
@ -131,8 +162,8 @@ namespace HeavenStudio.Games
if (queuedInputs.Count > 0) queuedInputs.Clear();
}
// these variables wouldn't get reset, even when you go in and out of unity play mode???
shouldBlip = false;
isStepping = false;
stepIterate = 0;
foreach (var evt in scheduledInputs)
{
@ -142,17 +173,16 @@ namespace HeavenStudio.Games
public void Update()
{
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused) {
if (Conductor.instance.isPlaying && !Conductor.instance.isPaused) {
if (queuedInputs.Count > 0) {
foreach (var input in queuedInputs) {
string dir = stepIterate % 2 == 1 ? "Right" : "Left";
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(input, delegate {
new BeatAction.Action(input, delegate {
instance.metronomeAnim.DoScaledAnimationAsync("MetronomeGo" + dir, 0.5f);
Jukebox.PlayOneShotGame("mrUpbeat/metronome" + dir);
ScheduleInput(input, 0.5f, InputType.STANDARD_DOWN, Success, Miss, Nothing);
if (MrUpbeat.noDing) queuedInputs.Add(input + 1);
if (MrUpbeat.shouldntStop) queuedInputs.Add(input + 1);
}),
});
stepIterate++;
@ -166,47 +196,36 @@ namespace HeavenStudio.Games
}
}
public void Ding(bool applause, bool stopBlipping)
public static void Ding(float beat, bool applause, bool stopBlipping)
{
Jukebox.PlayOneShotGame("mrUpbeat/ding");
if (applause) Jukebox.PlayOneShot("applause");
if (stopBlipping) shouldBlip = false;
MrUpbeat.shouldntStop = false;
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat, delegate {
MrUpbeat.isStepping = false;
Jukebox.PlayOneShotGame("mrUpbeat/ding");
if (applause) Jukebox.PlayOneShot("applause");
if (stopBlipping) MrUpbeat.shouldBlip = false;
}),
});
}
public static void StartStepping(float beat, float length, bool force)
public static void StartStepping(float beat, float length)
{
// mr. downbeat stuff. god i hate mr. downbeat
// force != true means that mr. upbeat will always blip/step on the offbeats
beat = force ? beat - 0.5f : MathF.Floor(beat);
downbeatMod = force ? (beat % 1) : 0.5f;
if (MrUpbeat.isStepping) return;
MrUpbeat.isStepping = true;
if (GameManager.instance.currentGame != "mrUpbeat") {
Blipping(beat, length);
MrUpbeat.shouldBlip = true;
} else {
BeatAction.New(instance.gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(beat, delegate {
MrUpbeat.shouldBlip = true;
new BeatAction.Action(MathF.Floor(beat), delegate {
MrUpbeat.shouldBlip = true;
}),
});
}
var dings = EventCaller.GetAllInGameManagerList("mrUpbeat", new string[] { "ding" });
if (dings.Count == 0) {
MrUpbeat.noDing = true;
queuedInputs.Add(beat + (force ? length : MathF.Floor(length)));
return;
}
MrUpbeat.noDing = false;
int whichDing = 0;
for (int i = 0; i < dings.Count; i++) {
if (dings[i].beat > beat) {
whichDing = i;
break;
}
}
for (int i = (int)length; i < dings[whichDing].beat - beat; i++) {
queuedInputs.Add(beat + i - (force ? downbeatMod : 0));
}
MrUpbeat.shouldntStop = true;
queuedInputs.Add(MathF.Floor(beat+length));
}
public static void Blipping(float beat, float length)
@ -223,8 +242,8 @@ namespace HeavenStudio.Games
}
}
for (int i = 0; i < switchGames[whichSwitch].beat - beat - 0.5f; i++) {
blips.Add(new MultiSound.Sound("mrUpbeat/blip", beat + 0.5f + i));
for (int i = 0; i < switchGames[whichSwitch].beat - MathF.Floor(beat) - 0.5f; i++) {
blips.Add(new MultiSound.Sound("mrUpbeat/blip", MathF.Floor(beat) + 0.5f + i));
}
MultiSound.Play(blips.ToArray(), forcePlay: true);
@ -271,12 +290,31 @@ namespace HeavenStudio.Games
public void BlipEvents(string inputLetter, bool shouldGrow, bool resetBlip, bool blip)
{
if (shouldGrow && man.blipSize < 4) man.blipSize++;
if (resetBlip) man.blipSize = 0;
man.shouldGrow = shouldGrow;
if (resetBlip) {
man.blipSize = 0;
man.shouldGrow = false;
}
man.blipString = inputLetter;
shouldBlip = blip;
}
/*
public static void Count(int number)
{
Jukebox.PlayOneShotGame("mrUpbeat/count"+(number + 1), forcePlay: true);
}
public static void CountIn(float beat, float length)
{
var sound = new List<MultiSound.Sound>() {
};
MultiSound.Play(sound.ToArray(), forcePlay: true);
}
*/
public void Nothing(PlayerActionEvent caller) {}
}
}

View File

@ -20,24 +20,22 @@ namespace HeavenStudio.Games.Scripts_MrUpbeat
public int stepTimes = 0;
public int blipSize = 0;
public bool shouldGrow;
public string blipString = "M";
public void Blip()
{
float c = Conductor.instance.songPositionInBeats;
// checks if the position is on an offbeat; accurate until you get down to 20 fps or so (i.e unplayable)
float pos = ((MathF.Floor(c * 10)/10 % 1) == 0.5f) ? MathF.Floor(c) : MathF.Round(c);
// recursive, should happen on the offbeat (unless downbeatMod is different)
BeatAction.New(gameObject, new List<BeatAction.Action>() {
new BeatAction.Action(pos + MrUpbeat.downbeatMod, delegate {
new BeatAction.Action(MathF.Floor(c) + 0.5f, delegate {
if (MrUpbeat.shouldBlip) {
Jukebox.PlayOneShotGame("mrUpbeat/blip");
blipAnim.Play("Blip"+(blipSize+1), 0, 0);
blipText.text = (blipSize == 4 && blipString != "") ? blipString : "";
if (shouldGrow && blipSize < 4) blipSize++;
}
}),
new BeatAction.Action(pos + MrUpbeat.downbeatMod + 0.999f, delegate {
new BeatAction.Action(MathF.Floor(c) + 1f, delegate {
Blip();
}),
});

View File

@ -109,6 +109,10 @@ namespace HeavenStudio.Games.Loaders
var e = eventCaller.currentEntity;
MunchyMonk.instance.PlayMonkAnim(e.beat, e["whichAnim"], e["vineBoom"]);
},
inactiveFunction = delegate {
var e = eventCaller.currentEntity;
MunchyMonk.instance.PlayMonkAnimInactive(e["vineBoom"]);
},
parameters = new List<Param>()
{
new Param("whichAnim", MunchyMonk.WhichMonkAnim.Stare, "Which Animation", "Which animation will the Monk play?"),
@ -211,8 +215,6 @@ namespace HeavenStudio.Games
float movingLength;
string moveAnim;
EasingFunction.Ease lastEase;
private Dumpling currentDumpling;
ScrollObject[] scrollObjects;
const string sfxName = "munchyMonk/";
@ -227,9 +229,7 @@ namespace HeavenStudio.Games
private void Start()
{
scrollObjects = FindObjectsByType<ScrollObject>(FindObjectsSortMode.None);
foreach (var obj in scrollObjects) {
obj.SpeedMod = scrollModCurrent;
}
foreach (var obj in scrollObjects) obj.SpeedMod = scrollModCurrent;
}
private void OnDestroy()
@ -254,15 +254,12 @@ namespace HeavenStudio.Games
private void Update()
{
// input stuff
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
{
if (PlayerInput.Pressed(true) && (!IsExpectingInputNow(InputType.STANDARD_DOWN) || !IsExpectingInputNow(InputType.DIRECTION_DOWN))) {
MonkArmsAnim.DoScaledAnimationAsync("WristSlap", 0.5f);
Jukebox.PlayOneShotGame(sfxName+"slap");
isStaring = false;
// early input stuff
if (dumplings.Count != 0) {
InputFunctions(3);
}
if (dumplings.Count != 0) InputFunctions(3);
}
// blushes when done eating but not when staring
@ -285,18 +282,14 @@ namespace HeavenStudio.Games
}
// resets the monk when game is stopped
if (!Conductor.instance.NotStopped()) {
MonkAnim.DoScaledAnimationAsync("Idle", 0.5f);
}
if (!Conductor.instance.NotStopped()) MonkAnim.DoScaledAnimationAsync("Idle", 0.5f);
if (isMoving) {
float normalizedBeat = Conductor.instance.GetPositionFromBeat(movingStartBeat, movingLength);
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase);
float newPos = func(0f, 1f, normalizedBeat);
MonkHolderAnim.DoNormalizedAnimation(moveAnim, newPos);
if (normalizedBeat >= 1f) {
isMoving = false;
}
if (normalizedBeat >= 1f) isMoving = false;
}
if (scrollRampUp) {
@ -308,24 +301,22 @@ namespace HeavenStudio.Games
scrollModCurrent = scrollMod;
}
foreach (var obj in scrollObjects) {
obj.SpeedMod = newPos;
}
foreach (var obj in scrollObjects) obj.SpeedMod = newPos;
}
// cue queuing stuff
if (queuedOnes.Count > 0) {
foreach (var dumpling in queuedOnes) { OneGoCue(dumpling.beat, dumpling.color1); }
foreach (var dumpling in queuedOnes) OneGoCue(dumpling.beat, dumpling.color1);
queuedOnes.Clear();
}
if (queuedTwoTwos.Count > 0) {
foreach (var dumpling in queuedTwoTwos) { TwoTwoCue(dumpling.beat, dumpling.color1, dumpling.color2); }
foreach (var dumpling in queuedTwoTwos) TwoTwoCue(dumpling.beat, dumpling.color1, dumpling.color2);
queuedTwoTwos.Clear();
}
if (queuedThrees.Count > 0) {
foreach (var dumpling in queuedThrees) { ThreeGoCue(dumpling.beat, dumpling.color1, dumpling.color2, dumpling.color3); }
foreach (var dumpling in queuedThrees) ThreeGoCue(dumpling.beat, dumpling.color1, dumpling.color2, dumpling.color3);
queuedThrees.Clear();
}
}
@ -360,17 +351,16 @@ namespace HeavenStudio.Games
public void InputFunctions(int whichVar, float state = 0)
{
currentDumpling = dumplings[dumplings.Count-1];
switch (whichVar)
{
case 1:
currentDumpling.HitFunction(state);
dumplings[dumplings.Count-1].HitFunction(state);
break;
case 2:
currentDumpling.MissFunction();
dumplings[dumplings.Count-1].MissFunction();
break;
case 3:
currentDumpling.EarlyFunction();
dumplings[dumplings.Count-1].EarlyFunction();
break;
}
dumplings.RemoveAt(dumplings.Count-1);
@ -390,10 +380,7 @@ namespace HeavenStudio.Games
public static void PreOneGoCue(float beat, Color firstColor)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound(sfxName+"one_1", beat),
new MultiSound.Sound(sfxName+"one_2", beat + 1f),
}, forcePlay: true);
PlaySoundSequence("munchyMonk", "one_go", beat);
queuedOnes.Add(new QueuedDumpling()
{ beat = beat, color1 = firstColor, });
@ -420,13 +407,8 @@ namespace HeavenStudio.Games
public static void PreTwoTwoCue(float beat, Color firstColor, Color secondColor)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound(sfxName+"two_1", beat - 0.5f),
new MultiSound.Sound(sfxName+"two_2", beat),
new MultiSound.Sound(sfxName+"two_3", beat + 1f),
new MultiSound.Sound(sfxName+"two_4", beat + 1.5f),
}, forcePlay: true);
PlaySoundSequence("munchyMonk", "two_go", beat);
queuedTwoTwos.Add(new QueuedDumpling() {
beat = beat,
color1 = firstColor,
@ -463,12 +445,7 @@ namespace HeavenStudio.Games
public static void PreThreeGoCue(float beat, Color firstColor, Color secondColor, Color thirdColor)
{
MultiSound.Play(new MultiSound.Sound[] {
new MultiSound.Sound(sfxName+"three_1", beat),
new MultiSound.Sound(sfxName+"three_2", beat + 1f),
new MultiSound.Sound(sfxName+"three_3", beat + 2f),
new MultiSound.Sound(sfxName+"three_4", beat + 3f),
}, forcePlay: true);
PlaySoundSequence("munchyMonk", "three_go", beat);
queuedThrees.Add(new QueuedDumpling() {
beat = beat,
@ -546,6 +523,11 @@ namespace HeavenStudio.Games
if (vineBoom) Jukebox.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true);
}
public void PlayMonkAnimInactive(bool vineBoom)
{
if (vineBoom) Jukebox.PlayOneShotGame("fanClub/arisa_dab", forcePlay: true);
}
public void MonkMove(float beat, float length, int goToSide, int ease)
{
movingStartBeat = beat;

View File

@ -40,11 +40,16 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
if (isActive && player)
{
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN))
if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN)) {
OctoAction("Squeeze");
Jukebox.PlayOneShotGame("nearMiss");
game.hasMissed = true;
}
if (PlayerInput.PressedUp() && !game.IsExpectingInputNow(InputType.STANDARD_UP)) {
OctoAction(PlayerInput.Pressing(true) ? "Pop" : "Release");
Jukebox.PlayOneShotGame("nearMiss");
game.hasMissed = true;
}
}
}
@ -75,6 +80,8 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
2 => "Angry",
3 => "Oops",
}, 0.5f);
isPreparing =
isSqueezed = false;
}
public void ForceSqueeze()

View File

@ -75,13 +75,14 @@ namespace HeavenStudio.Games.Loaders
{
function = delegate {
var e = eventCaller.currentEntity;
OctopusMachine.instance.AutoAction(e["autoBop"], e["autoText"], e["hitText"], e["missText"]);
OctopusMachine.instance.AutoAction(e["forceBop"], e["autoBop"], e["autoText"], e["hitText"], e["missText"]);
},
parameters = new List<Param>() {
new Param("forceBop", true, "Force Bop", "Forces a bop, even if an animation is playing."),
new Param("autoBop", true, "Hit/Miss Bop", "Plays a bop depending on if you hit or missed the cues."),
new Param("autoText", true, "Display Text", "Displays text depending on if you hit or missed the cues."),
new Param("hitText", "Good!", "Hit Text", "The text to display if you hit the cues."),
new Param("missText", "Wrong! n/ Try again!", "Miss Text", "The text to display if you missed the cues."),
new Param("missText", "Wrong! Try again!", "Miss Text", "The text to display if you missed the cues."),
},
},
new GameAction("forceSqueeze", "Force Squeeze")
@ -240,7 +241,7 @@ namespace HeavenStudio.Games
{
if (queuePrepare) {
foreach (var octo in octopodes) octo.queuePrepare = true;
if (Text.text is "Wrong! \nTry Again!" or "Good!") Text.text = "";
if (Text.text is "Wrong! Try Again!" or "Good!") Text.text = "";
queuePrepare = false;
}
@ -276,12 +277,15 @@ namespace HeavenStudio.Games
YouArrow.SetActive(youText != "");
}
public void AutoAction(bool autoBop, bool autoText, string hitText, string missText)
public void AutoAction(bool forceBop, bool autoBop, bool autoText, string hitText, string missText)
{
autoAction = true;
if (autoBop) bopStatus = hasMissed ? 2 : 1;
if (autoText) Text.text = hasMissed ? missText : hitText;
foreach (var octo in octopodes) octo.cantBop = false;
foreach (var octo in octopodes) {
if (forceBop) octo.PlayAnimation(bopStatus);
octo.cantBop = false;
}
hasMissed = false;
}
@ -398,21 +402,21 @@ namespace HeavenStudio.Games
private void SqueezeHit(PlayerActionEvent caller, float state)
{
octopodes[2].OctoAction("Squeeze");
if (state <= -1f || state >= 1f) Jukebox.PlayOneShotGame("nearMiss");
}
private void ReleaseHit(PlayerActionEvent caller, float state)
{
octopodes[2].OctoAction("Release");
if (state <= -1f || state >= 1f) Jukebox.PlayOneShotGame("nearMiss");
}
private void PopHit(PlayerActionEvent caller, float state)
{
octopodes[2].OctoAction("Pop");
if (state <= -1f || state >= 1f) Jukebox.PlayOneShotGame("nearMiss");
}
private void Miss(PlayerActionEvent caller)
{
hasMissed = true;
}
private void Miss(PlayerActionEvent caller) { }
}
}

View File

@ -52,7 +52,6 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("camera", "Zoom Camera")
{
function = delegate { Spaceball.instance.OverrideCurrentZoom(); },
defaultLength = 4,
resizable = true,
parameters = new List<Param>()
@ -93,10 +92,10 @@ namespace HeavenStudio.Games
SphereHead
}
public GameObject Ball;
public GameObject BallsHolder;
[SerializeField] GameObject Ball;
[SerializeField] GameObject BallsHolder;
public GameObject Dispenser;
[SerializeField] GameObject Dispenser;
public GameObject Dust;
private float lastCamDistance;
@ -106,8 +105,8 @@ namespace HeavenStudio.Games
private int currentZoomIndex;
public Sprite[] BallSprites;
public Material[] CostumeColors;
[SerializeField] Sprite[] BallSprites;
[SerializeField] Material[] CostumeColors;
private List<DynamicBeatmap.DynamicEntity> _allCameraEvents = new List<DynamicBeatmap.DynamicEntity>();
@ -147,7 +146,7 @@ namespace HeavenStudio.Games
_allCameraEvents = tempEvents;
UpdateCameraZoom();
currentZoomCamDistance = -10;
}
private void Update()
@ -225,11 +224,6 @@ namespace HeavenStudio.Games
}
}
public void OverrideCurrentZoom()
{
// lastCamDistance = GameCamera.instance.camera.transform.localPosition.z;
}
public void Shoot(float beat, bool high, int type)
{
GameObject ball = Instantiate(Ball);