2022-08-26 08:29:26 +00:00
//notes:
2022-08-27 04:40:49 +00:00
// BEFORE NEW PROPS
2022-09-06 06:41:13 +00:00
// - minenice will also use this to test out randomly named parameters so coding has to rest until the new props update [DONE]
// - see fan club for separate prefabs (cadets) [DONE]
// - 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-09-06 06:41:13 +00:00
// - testmod marching orders using speed
// - see space soccer, mr upbeat, tunnel for keep-the-beat codes
// - figure how to do custom bg changes when the upscaled textures are finished (see karate man, launch party once it releases)
// - 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-09-06 06:41:13 +00:00
// - 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-09-04 05:55:12 +00:00
new GameAction ( "bop" , "Bop" )
2022-09-10 12:56:26 +00:00
{
function = delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . Bop ( e . beat , e . length ) ; } ,
2022-09-04 05:55:12 +00:00
defaultLength = 1f ,
2022-09-10 12:56:26 +00:00
resizable = true
} ,
new GameAction ( "marching" , "Cadets March" )
{
function = delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . CadetsMarch ( e . beat , e . length ) ; } ,
2022-09-06 06:41:13 +00:00
defaultLength = 4f ,
2022-09-10 12:56:26 +00:00
resizable = true
} ,
2022-08-27 04:40:49 +00:00
2022-09-04 05:55:12 +00:00
new GameAction ( "attention" , "Attention..." )
2022-09-10 12:56:26 +00:00
{
function = delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . SargeAttention ( e . beat ) ; } ,
defaultLength = 2.25f ,
inactiveFunction = delegate { var e = eventCaller . currentEntity ; MarchingOrders . AttentionSound ( e . beat ) ; }
2022-09-04 05:55:12 +00:00
} ,
2022-09-10 12:56:26 +00:00
new GameAction ( "march" , "March!" )
{
function = delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . SargeMarch ( e . beat ) ; } ,
defaultLength = 2f ,
2022-09-04 05:55:12 +00:00
inactiveFunction = delegate { var e = eventCaller . currentEntity ; MarchingOrders . MarchSound ( e . beat ) ; }
2022-09-10 12:56:26 +00:00
} ,
new GameAction ( "halt" , "Halt!" )
{
function = delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . SargeHalt ( e . beat ) ; } ,
defaultLength = 2f ,
2022-09-06 06:41:13 +00:00
inactiveFunction = delegate { var e = eventCaller . currentEntity ; MarchingOrders . HaltSound ( e . beat ) ; }
2022-09-04 05:55:12 +00:00
} ,
2022-09-10 12:56:26 +00:00
new GameAction ( "face turn" , "Direction to Turn" )
2022-09-08 12:38:45 +00:00
{
2022-09-10 12:56:26 +00:00
function = delegate { var e = eventCaller . currentEntity ; MarchingOrders . instance . SargeFaceTurn ( e . beat , e [ "type" ] , e [ "type2" ] ) ; } ,
defaultLength = 4f ,
parameters = new List < Param > ( )
2022-09-08 12:38:45 +00:00
{
new Param ( "type" , MarchingOrders . DirectionFaceTurn . Right , "Direction" , "The direction sarge wants the cadets to face" ) ,
new Param ( "type2" , MarchingOrders . FaceTurnLength . Normal , "Length" , "How fast or slow the event lasts" ) ,
}
} ,
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-09-10 12:56:26 +00:00
//code is just copied from other minigame code, i will polish them later
[Header("References")]
2022-08-28 00:45:55 +00:00
public Animator Sarge ;
public Animator Cadet1 ;
public Animator Cadet2 ;
public Animator Cadet3 ;
2022-09-10 12:56:26 +00:00
public Animator CadetPlayer ;
public Animator CadetHead1 ;
public Animator CadetHead2 ;
public Animator CadetHead3 ;
public Animator CadetHeadPlayer ;
2022-09-08 12:38:45 +00:00
public GameObject Player ;
2022-09-10 12:56:26 +00:00
public GameEvent bop = new GameEvent ( ) ;
public GameEvent noBop = new GameEvent ( ) ;
public GameEvent marching = new GameEvent ( ) ;
private int marchOtherCount ;
private int marchPlayerCount ;
private int turnLength ;
2022-08-27 04:40:49 +00:00
public static MarchingOrders instance ;
public enum DirectionFaceTurn
2022-09-10 12:56:26 +00:00
{
2022-08-24 12:47:41 +00:00
Right ,
Left ,
2022-08-27 04:40:49 +00:00
}
public enum FaceTurnLength
2022-09-10 12:56:26 +00:00
{
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-09-10 12:56:26 +00:00
var cond = Conductor . instance ;
2022-08-29 14:07:32 +00:00
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 ) )
2022-09-05 07:46:19 +00:00
Cadet1 . DoScaledAnimationAsync ( "Bop" , 0.5f ) ;
2022-09-10 12:56:26 +00:00
Cadet2 . DoScaledAnimationAsync ( "Bop" , 0.5f ) ;
Cadet3 . DoScaledAnimationAsync ( "Bop" , 0.5f ) ;
CadetPlayer . DoScaledAnimationAsync ( "Bop" , 0.5f ) ;
2022-08-29 14:07:32 +00:00
}
}
2022-09-10 12:56:26 +00:00
if ( cond . ReportBeat ( ref marching . lastReportedBeat , bop . startBeat % 1 ) )
2022-09-06 06:41:13 +00:00
{
if ( cond . songPositionInBeats > = marching . startBeat & & cond . songPositionInBeats < marching . startBeat + marching . length )
{
2022-09-10 12:56:26 +00:00
marchOtherCount + = 1 ;
var marchAnim = ( marchOtherCount % 2 ! = 0 ? "MarchR" : "MarchL" ) ;
2022-09-08 09:13:21 +00:00
Jukebox . PlayOneShotGame ( "marchingOrders/step1" ) ;
2022-09-10 12:56:26 +00:00
Cadet1 . DoScaledAnimationAsync ( marchAnim , 0.5f ) ;
Cadet2 . DoScaledAnimationAsync ( marchAnim , 0.5f ) ;
Cadet3 . DoScaledAnimationAsync ( marchAnim , 0.5f ) ;
2022-09-06 06:41:13 +00:00
}
}
2022-09-10 12:56:26 +00:00
if ( PlayerInput . Pressed ( ) & & ! IsExpectingInputNow ( ) )
2022-08-28 12:53:13 +00:00
{
2022-09-04 05:55:12 +00:00
Jukebox . PlayOneShot ( "miss" ) ;
2022-09-05 07:46:19 +00:00
Sarge . DoScaledAnimationAsync ( "Anger" , 0.5f ) ;
2022-08-28 12:53:13 +00:00
}
2022-08-24 02:22:20 +00:00
}
2022-08-27 04:40:49 +00:00
2022-09-10 12:56:26 +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-09-10 12:56:26 +00:00
2022-09-06 06:41:13 +00:00
public void CadetsMarch ( float beat , float length )
2022-08-27 04:40:49 +00:00
{
2022-09-06 06:41:13 +00:00
marching . length = length ;
2022-09-10 12:56:26 +00:00
marching . startBeat = beat ;
2022-08-27 04:40:49 +00:00
}
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-09-10 12:56:26 +00:00
BeatAction . New ( Player , new List < BeatAction . Action > ( )
2022-08-28 00:45:55 +00:00
{
2022-09-05 07:46:19 +00:00
new BeatAction . Action ( beat + 0.25f , delegate { Sarge . DoScaledAnimationAsync ( "Talk" , 0.5f ) ; } ) ,
2022-08-28 00:45:55 +00:00
} ) ;
2022-08-27 04:40:49 +00:00
}
2022-09-10 12:56:26 +00:00
public void SargeMarch ( float beat )
2022-08-28 00:45:55 +00:00
{
2022-09-10 12:56:26 +00:00
marchOtherCount = 0 ;
marchPlayerCount = 0 ;
MultiSound . Play ( new MultiSound . Sound [ ] {
2022-08-28 05:38:49 +00:00
new MultiSound . Sound ( "marchingOrders/march1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/march2" , beat + 1f ) ,
2022-09-03 06:09:23 +00:00
} , forcePlay : true ) ;
2022-09-10 12:56:26 +00:00
BeatAction . New ( Player , new List < BeatAction . Action > ( )
2022-08-28 00:45:55 +00:00
{
2022-09-05 07:46:19 +00:00
new BeatAction . Action ( beat , delegate { Sarge . DoScaledAnimationAsync ( "Talk" , 0.5f ) ; } ) ,
2022-09-10 12:56:26 +00:00
new BeatAction . Action ( beat + 1f , delegate { Cadet1 . DoScaledAnimationAsync ( "MarchL" , 0.5f ) ; } ) ,
2022-09-05 07:46:19 +00:00
new BeatAction . Action ( beat + 1f , delegate { Cadet2 . DoScaledAnimationAsync ( "MarchL" , 0.5f ) ; } ) ,
2022-09-10 12:56:26 +00:00
new BeatAction . Action ( beat + 1f , delegate { Cadet3 . DoScaledAnimationAsync ( "MarchL" , 0.5f ) ; } ) ,
new BeatAction . Action ( beat + 1f , delegate { CadetPlayer . DoScaledAnimationAsync ( "MarchL" , 0.5f ) ; } ) ,
} ) ;
2022-08-28 00:45:55 +00:00
}
2022-09-10 12:56:26 +00:00
public void SargeHalt ( float beat )
2022-08-29 14:07:32 +00:00
{
2022-09-10 12:56:26 +00:00
MultiSound . Play ( new MultiSound . Sound [ ] {
2022-08-29 14:07:32 +00:00
new MultiSound . Sound ( "marchingOrders/halt1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/halt2" , beat + 1f ) ,
2022-09-10 12:56:26 +00:00
new MultiSound . Sound ( "marchingOrders/step1" , beat + 1f ) ,
2022-09-03 06:09:23 +00:00
} , forcePlay : true ) ;
2022-09-10 12:56:26 +00:00
BeatAction . New ( Player , new List < BeatAction . Action > ( )
2022-08-29 14:07:32 +00:00
{
2022-09-05 07:46:19 +00:00
new BeatAction . Action ( beat , delegate { Sarge . DoScaledAnimationAsync ( "Talk" , 0.5f ) ; } ) ,
2022-09-10 12:56:26 +00:00
new BeatAction . Action ( beat + 1f , delegate { Cadet1 . DoScaledAnimationAsync ( "Halt" , 0.5f ) ; } ) ,
2022-09-06 06:41:13 +00:00
new BeatAction . Action ( beat + 1f , delegate { Cadet2 . DoScaledAnimationAsync ( "Halt" , 0.5f ) ; } ) ,
2022-09-10 12:56:26 +00:00
new BeatAction . Action ( beat + 1f , delegate { Cadet3 . DoScaledAnimationAsync ( "Halt" , 0.5f ) ; } ) ,
} ) ;
2022-09-03 06:09:23 +00:00
}
2022-09-10 12:56:26 +00:00
public void SargeFaceTurn ( float beat , int type , int type2 )
2022-09-08 12:38:45 +00:00
{
2022-09-10 12:56:26 +00:00
switch ( type2 )
{
case ( int ) MarchingOrders . FaceTurnLength . Fast :
turnLength = 0 ;
break ;
default :
turnLength = 1 ;
break ;
2022-09-08 12:38:45 +00:00
}
2022-09-10 12:56:26 +00:00
switch ( type )
2022-09-08 12:38:45 +00:00
{
case ( int ) MarchingOrders . DirectionFaceTurn . Left :
2022-09-10 12:56:26 +00:00
//ScheduleInput(beat, turnLength + 2f, InputType.DIRECTION_RIGHT_DOWN, LeftSuccess, LeftMiss, LeftEmpty);
2022-09-08 12:38:45 +00:00
MultiSound . Play ( new MultiSound . Sound [ ] {
2022-09-10 12:56:26 +00:00
new MultiSound . Sound ( "marchingOrders/leftFaceTurn1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/leftFaceTurn2" , beat + 0.5f ) ,
new MultiSound . Sound ( "marchingOrders/leftFaceTurn3" , beat + turnLength + 1f ) ,
new MultiSound . Sound ( "marchingOrders/leftFaceTurn4" , beat + turnLength + 2f ) ,
} , forcePlay : true ) ;
BeatAction . New ( Player , new List < BeatAction . Action > ( )
{
new BeatAction . Action ( beat + turnLength + 2f , delegate { CadetHead1 . DoScaledAnimationAsync ( "FaceL" , 0.5f ) ; } ) ,
new BeatAction . Action ( beat + turnLength + 2f , delegate { CadetHead2 . DoScaledAnimationAsync ( "FaceL" , 0.5f ) ; } ) ,
new BeatAction . Action ( beat + turnLength + 2f , delegate { CadetHead3 . DoScaledAnimationAsync ( "FaceL" , 0.5f ) ; } ) ,
} ) ;
2022-09-08 12:38:45 +00:00
break ;
2022-09-10 12:56:26 +00:00
default :
MultiSound . Play ( new MultiSound . Sound [ ] {
new MultiSound . Sound ( "marchingOrders/rightFaceTurn1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/rightFaceTurn2" , beat + 0.5f ) ,
new MultiSound . Sound ( "marchingOrders/rightFaceTurn3" , beat + turnLength + 1f ) ,
new MultiSound . Sound ( "marchingOrders/rightFaceTurn4" , beat + turnLength + 2f ) ,
} , forcePlay : true ) ;
BeatAction . New ( Player , new List < BeatAction . Action > ( )
{
new BeatAction . Action ( beat + turnLength + 2f , delegate { CadetHead1 . DoScaledAnimationAsync ( "FaceR" , 0.5f ) ; } ) ,
new BeatAction . Action ( beat + turnLength + 2f , delegate { CadetHead2 . DoScaledAnimationAsync ( "FaceR" , 0.5f ) ; } ) ,
new BeatAction . Action ( beat + turnLength + 2f , delegate { CadetHead3 . DoScaledAnimationAsync ( "FaceR" , 0.5f ) ; } ) ,
} ) ;
break ;
}
BeatAction . New ( Player , 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 ) ; } ) ,
} ) ;
}
public static void AttentionSound ( float beat )
2022-09-03 06:09:23 +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 ) ,
} , forcePlay : true ) ;
}
2022-09-10 12:56:26 +00:00
public static void MarchSound ( float beat )
2022-09-03 06:09:23 +00:00
{
MultiSound . Play ( new MultiSound . Sound [ ] {
new MultiSound . Sound ( "marchingOrders/march1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/march2" , beat + 1f ) ,
} , forcePlay : true ) ;
2022-09-06 06:41:13 +00:00
}
2022-09-10 12:56:26 +00:00
public static void HaltSound ( float beat )
2022-09-06 06:41:13 +00:00
{
MultiSound . Play ( new MultiSound . Sound [ ] {
new MultiSound . Sound ( "marchingOrders/halt1" , beat ) ,
new MultiSound . Sound ( "marchingOrders/halt2" , beat + 1f ) ,
} , forcePlay : true ) ;
2022-08-29 14:07:32 +00:00
}
2022-08-24 02:22:20 +00:00
}
}