2022-08-26 08:29:26 +00:00
//notes:
2022-08-27 04:40:49 +00:00
// BEFORE NEW PROPS
2022-08-26 10:48:32 +00:00
//1. minenice will also use this to test out randomly named parameters so coding has to rest until the new props update
//2. see fan club for separate prefabs (cadets) [DONE]
2022-08-26 12:38:26 +00:00
//3. temporarily take sounds from rhre, wait until someone records the full code, including misses, or record it myself (unlikely) [IN PROGRESS]
2022-08-27 04:40:49 +00:00
// AFTER NEW PROPS
2022-08-26 10:48:32 +00:00
//4. see space soccer, mr upbeat, tunnel for keep-the-beat codes
//5. figure how to do custom bg changes when the upscaled textures are finished (see karate man, launch party once it releases)
//6. will use a textbox without going through the visual options but i wonder how..?? (see first contact if ever textboxes are implemented in said minigame)
2022-08-27 04:40:49 +00:00
// AFTER FEATURE COMPLETION
2022-08-26 10:48:32 +00:00
//7. delete all notes once the minigame is considered feature-complete
2022-08-26 08:29:26 +00:00
2022-08-24 02:22:20 +00:00
using HeavenStudio.Util ;
using System ;
using System.Collections.Generic ;
using UnityEngine ;
namespace HeavenStudio.Games.Loaders
{
using static Minigames ;
2022-08-27 04:40:49 +00:00
public static class AgbMarcherLoader
2022-08-24 02:22:20 +00:00
{
public static Minigame AddGame ( EventCaller eventCaller ) {
2022-08-24 12:47:41 +00:00
return new Minigame ( "marchingOrders" , "Marching Orders \n<color=#eb5454>[WIP]</color>" , "00A43B" , false , false , new List < GameAction > ( )
2022-08-24 02:22:20 +00:00
{
2022-08-27 04:40:49 +00:00
//from krispy:
//i'm not that good at coding but i'll try my best to make a minigame
//please don't take over... i'll get back into it once i know coding
//thank you and have a nice day!
//the cues do nothing at the moment, so i temporarily disabled them
2022-08-29 14:07:32 +00:00
new GameAction ( "bop" , delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . Bop ( e . beat , e . length ) ; } , 1f , true ) ,
2022-08-27 04:40:49 +00:00
//new GameAction("marching", delegate { MarchingOrders.instance.CadetsMarch(eventCaller.currentEntity.beat); }, 4f, true),
2022-09-03 06:09:23 +00:00
new GameAction ( "attention" , delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . SargeAttention ( e . beat ) ; } , 2.25f , false ,
inactiveFunction : delegate { var e = eventCaller . currentEntity ; MarchingOrders . AttentionSound ( e . beat ) ; } ) ,
new GameAction ( "march" , delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . SargeMarch ( e . beat ) ; } , 2.0f , false ,
inactiveFunction : delegate { var e = eventCaller . currentEntity ; MarchingOrders . MarchSound ( e . beat ) ; } ) ,
new GameAction ( "halt" , delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . SargeHalt ( e . beat ) ; } , 2f , false ) ,
2022-08-27 04:40:49 +00:00
//new GameAction("face turn", delegate {}, 4f, false, parameters: new List<Param>()
//{
2022-08-24 12:47:41 +00:00
// new Param("type", MarchingOrders.DirectionFaceTurn.Right, "Direction", "The direction sarge wants the cadets to face"),
2022-08-28 00:45:55 +00:00
// new Param("type2", MarchingOrders.FaceTurnLength.Normal, "Length", "How fast or slow the event lasts"),
2022-08-24 12:47:41 +00:00
//}),
2022-08-24 02:22:20 +00:00
} ) ;
}
}
}
namespace HeavenStudio.Games
{
2022-08-24 12:47:41 +00:00
//using Scripts_MarchingOrders;
2022-08-24 02:22:20 +00:00
public class MarchingOrders : Minigame
{
2022-08-29 14:07:32 +00:00
//code is just copied from other minigame code, i will polish them later
2022-08-28 05:38:49 +00:00
[Header("References")]
2022-08-28 00:45:55 +00:00
public Animator Sarge ;
public Animator Cadet1 ;
public Animator Cadet2 ;
public Animator Cadet3 ;
public Animator CadetPlayer ;
public GameObject Player ;
2022-08-29 14:07:32 +00:00
public GameEvent bop = new GameEvent ( ) ;
public GameEvent noBop = new GameEvent ( ) ;
2022-08-27 04:40:49 +00:00
public static MarchingOrders instance ;
public enum DirectionFaceTurn
{
2022-08-24 12:47:41 +00:00
Right ,
Left ,
2022-08-27 04:40:49 +00:00
}
public enum FaceTurnLength
{
2022-08-24 12:47:41 +00:00
Normal ,
Fast ,
2022-08-27 04:40:49 +00:00
}
2022-08-24 02:22:20 +00:00
// Start is called before the first frame update
void Awake ( )
{
2022-08-26 08:29:26 +00:00
instance = this ;
2022-08-24 02:22:20 +00:00
}
// Update is called once per frame
void Update ( )
{
2022-08-29 14:07:32 +00:00
var cond = Conductor . instance ;
if ( cond . ReportBeat ( ref bop . lastReportedBeat , bop . startBeat % 1 ) )
{
if ( cond . songPositionInBeats > = bop . startBeat & & cond . songPositionInBeats < bop . startBeat + bop . length )
{
if ( ! ( cond . songPositionInBeats > = noBop . startBeat & & cond . songPositionInBeats < noBop . startBeat + noBop . length ) )
Cadet1 . Play ( "Bop" , - 1 , 0 ) ;
Cadet2 . Play ( "Bop" , - 1 , 0 ) ;
Cadet3 . Play ( "Bop" , - 1 , 0 ) ;
CadetPlayer . Play ( "Bop" , - 1 , 0 ) ;
}
}
2022-08-28 12:53:13 +00:00
if ( PlayerInput . Pressed ( ) & & ! IsExpectingInputNow ( ) )
{
Jukebox . PlayOneShotGame ( "miss" ) ;
Sarge . Play ( "Anger" , - 1 , 0 ) ;
}
2022-08-24 02:22:20 +00:00
}
2022-08-27 04:40:49 +00:00
2022-08-29 14:07:32 +00:00
public void Bop ( float beat , float length )
2022-08-28 05:38:49 +00:00
{
2022-08-29 14:07:32 +00:00
bop . length = length ;
bop . startBeat = beat ;
2022-08-28 05:38:49 +00:00
}
2022-08-27 04:40:49 +00:00
public void CadetsMarch ( float beat )
{
}
public void SargeAttention ( float beat )
{
2022-08-28 00:45:55 +00:00
MultiSound . Play ( new MultiSound . Sound [ ] {
new MultiSound . Sound ( "marchingOrders/attention1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/attention2" , beat + 0.25f ) ,
new MultiSound . Sound ( "marchingOrders/attention3" , beat + 0.75f ) ,
2022-09-03 06:09:23 +00:00
} , forcePlay : true ) ;
2022-08-28 00:45:55 +00:00
BeatAction . New ( Player , new List < BeatAction . Action > ( )
{
new BeatAction . Action ( beat + 0.25f , delegate { Sarge . Play ( "Talk" , - 1 , 0 ) ; } ) ,
} ) ;
2022-08-27 04:40:49 +00:00
}
2022-08-28 00:45:55 +00:00
public void SargeMarch ( float beat )
{
2022-08-28 05:38:49 +00:00
MultiSound . Play ( new MultiSound . Sound [ ] {
new MultiSound . Sound ( "marchingOrders/march1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/march2" , beat + 1f ) ,
2022-09-03 06:09:23 +00:00
} , forcePlay : true ) ;
2022-08-28 05:38:49 +00:00
2022-08-28 00:45:55 +00:00
BeatAction . New ( Player , new List < BeatAction . Action > ( )
{
new BeatAction . Action ( beat , delegate { Sarge . Play ( "Talk" , - 1 , 0 ) ; } ) ,
2022-08-29 14:07:32 +00:00
new BeatAction . Action ( beat + 1f , delegate { Cadet1 . Play ( "MarchL" , - 1 , 0 ) ; } ) ,
new BeatAction . Action ( beat + 1f , delegate { Cadet2 . Play ( "MarchL" , - 1 , 0 ) ; } ) ,
new BeatAction . Action ( beat + 1f , delegate { Cadet3 . Play ( "MarchL" , - 1 , 0 ) ; } ) ,
new BeatAction . Action ( beat + 1f , delegate { CadetPlayer . Play ( "MarchL" , - 1 , 0 ) ; } ) ,
} ) ;
2022-08-28 00:45:55 +00:00
}
2022-08-29 14:07:32 +00:00
public void SargeHalt ( float beat )
{
MultiSound . Play ( new MultiSound . Sound [ ] {
new MultiSound . Sound ( "marchingOrders/halt1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/halt2" , beat + 1f ) ,
2022-09-03 06:09:23 +00:00
} , forcePlay : true ) ;
2022-08-29 14:07:32 +00:00
BeatAction . New ( Player , new List < BeatAction . Action > ( )
{
new BeatAction . Action ( beat , delegate { Sarge . Play ( "Talk" , - 1 , 0 ) ; } ) ,
} ) ;
2022-09-03 06:09:23 +00:00
}
public static void AttentionSound ( float beat )
{
MultiSound . Play ( new MultiSound . Sound [ ] {
new MultiSound . Sound ( "marchingOrders/attention1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/attention2" , beat + 0.25f ) ,
new MultiSound . Sound ( "marchingOrders/attention3" , beat + 0.75f ) ,
} , forcePlay : true ) ;
}
public static void MarchSound ( float beat )
{
MultiSound . Play ( new MultiSound . Sound [ ] {
new MultiSound . Sound ( "marchingOrders/march1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/march2" , beat + 1f ) ,
} , forcePlay : true ) ;
2022-08-29 14:07:32 +00:00
}
2022-08-24 02:22:20 +00:00
}
}