2022-06-26 06:48:14 +00:00
using HeavenStudio.Util ;
using System ;
using System.Collections.Generic ;
using UnityEngine ;
2023-02-27 20:13:10 +00:00
using DG.Tweening ;
2023-06-06 18:59:56 +00:00
using HeavenStudio.Common ;
2022-06-26 06:48:14 +00:00
namespace HeavenStudio.Games.Loaders
{
using static Minigames ;
public static class AgbSpaceDanceLoader
{
public static Minigame AddGame ( EventCaller eventCaller ) {
2023-04-02 02:28:23 +00:00
return new Minigame ( "spaceDance" , "Space Dance" , "0014d6" , false , false , new List < GameAction > ( )
2022-06-26 06:48:14 +00:00
{
2022-08-21 03:13:52 +00:00
new GameAction ( "turn right" , "Turn Right" )
{
2023-07-13 00:35:47 +00:00
function = delegate { var e = eventCaller . currentEntity ; SpaceDance . instance . DoTurnRight ( e . beat , e [ "gramps" ] ) ; } ,
preFunction = delegate { var e = eventCaller . currentEntity ; SpaceDance . TurnRightSfx ( e . beat , e [ "whoSpeaks" ] ) ; } ,
2023-02-27 20:13:10 +00:00
defaultLength = 2.0f ,
parameters = new List < Param > ( )
{
new Param ( "whoSpeaks" , SpaceDance . WhoSpeaks . Dancers , "Who Speaks?" , "Who will say the voice line for the cue?" ) ,
new Param ( "gramps" , false , "Space Gramps Animations" , "Will Space Gramps turn right?" )
}
2022-08-21 03:13:52 +00:00
} ,
new GameAction ( "sit down" , "Sit Down" )
{
2023-07-13 00:35:47 +00:00
function = delegate { var e = eventCaller . currentEntity ; SpaceDance . instance . DoSitDown ( e . beat , e [ "gramps" ] ) ; } ,
preFunction = delegate { var e = eventCaller . currentEntity ; SpaceDance . SitDownSfx ( e . beat , e [ "whoSpeaks" ] ) ; } ,
2023-02-27 20:13:10 +00:00
defaultLength = 2.0f ,
parameters = new List < Param > ( )
{
new Param ( "whoSpeaks" , SpaceDance . WhoSpeaks . Dancers , "Who Speaks?" , "Who will say the voice line for the cue?" ) ,
new Param ( "gramps" , false , "Space Gramps Animations" , "Will Space Gramps turn right?" )
}
2022-08-21 03:13:52 +00:00
} ,
new GameAction ( "punch" , "Punch" )
{
2023-07-13 00:35:47 +00:00
function = delegate { var e = eventCaller . currentEntity ; SpaceDance . instance . DoPunch ( e . beat , e [ "gramps" ] ) ; } ,
preFunction = delegate { var e = eventCaller . currentEntity ; SpaceDance . PunchSfx ( e . beat , e [ "whoSpeaks" ] ) ; } ,
2023-02-27 20:13:10 +00:00
defaultLength = 2.0f ,
parameters = new List < Param > ( )
{
new Param ( "whoSpeaks" , SpaceDance . WhoSpeaks . Dancers , "Who Speaks?" , "Who will say the voice line for the cue?" ) ,
new Param ( "gramps" , false , "Space Gramps Animations" , "Will Space Gramps turn right?" )
}
2022-08-21 03:13:52 +00:00
} ,
2023-02-27 20:13:10 +00:00
new GameAction ( "shootingStar" , "Shooting Star" )
2022-08-21 03:13:52 +00:00
{
2023-07-13 00:35:47 +00:00
function = delegate { var e = eventCaller . currentEntity ; SpaceDance . instance . UpdateShootingStar ( e . beat , e . length , ( EasingFunction . Ease ) e [ "ease" ] ) ; } ,
2023-02-27 20:13:10 +00:00
defaultLength = 2f ,
resizable = true ,
parameters = new List < Param > ( )
{
new Param ( "ease" , EasingFunction . Ease . Linear , "Ease" , "Which ease should the shooting of the stars use?" )
}
2022-08-21 03:13:52 +00:00
} ,
2023-02-27 20:13:10 +00:00
new GameAction ( "changeBG" , "Change Background Color" )
{
function = delegate { var e = eventCaller . currentEntity ; SpaceDance . instance . FadeBackgroundColor ( e [ "start" ] , e [ "end" ] , e . length , e [ "toggle" ] ) ; } ,
defaultLength = 1f ,
resizable = true ,
parameters = new List < Param > ( )
{
new Param ( "start" , SpaceDance . defaultBGColor , "Start Color" , "The start color for the fade or the color that will be switched to if -instant- is ticked on." ) ,
new Param ( "end" , SpaceDance . defaultBGColor , "End Color" , "The end color for the fade." ) ,
new Param ( "toggle" , false , "Instant" , "Should the background instantly change color?" )
}
} ,
2023-06-06 18:59:56 +00:00
new GameAction ( "bop" , "Bop" )
2023-02-27 20:13:10 +00:00
{
2023-06-06 18:59:56 +00:00
function = delegate { var e = eventCaller . currentEntity ; SpaceDance . instance . EpicBop ( e . beat , e . length , e [ "auto" ] , e [ "bop" ] , e [ "grampsAuto" ] , e [ "gramps" ] ) ; } ,
2023-02-27 20:13:10 +00:00
parameters = new List < Param > ( )
{
2023-06-06 18:59:56 +00:00
new Param ( "bop" , true , "Dancers Bop" , "Should the dancers bop?" ) ,
new Param ( "auto" , false , "Dancers Bop (Auto)" , "Should the dancers auto bop?" ) ,
new Param ( "gramps" , false , "Gramps Bop" , "Should Space Gramps bop with the dancers?" ) ,
new Param ( "grampsAuto" , false , "Gramps Bop (Auto)" , "Should Space Gramps auto bop with the dancers?" )
} ,
resizable = true ,
defaultLength = 4f
2023-03-03 19:19:33 +00:00
} ,
new GameAction ( "grampsAnims" , "Space Gramps Animations" )
{
function = delegate { var e = eventCaller . currentEntity ; SpaceDance . instance . GrampsAnimations ( e . beat , e [ "type" ] , e [ "toggle" ] ) ; } ,
defaultLength = 0.5f ,
parameters = new List < Param > ( )
{
new Param ( "toggle" , true , "Looping" , "Should the animation loop?" ) ,
new Param ( "type" , SpaceDance . GrampsAnimationType . Talk , "Which animation?" , "Which animation should space gramps do?" )
}
2023-06-06 18:59:56 +00:00
} ,
new GameAction ( "scroll" , "Scrolling Background" )
{
function = delegate { var e = eventCaller . currentEntity ; SpaceDance . instance . UpdateScrollSpeed ( e [ "x" ] , e [ "y" ] ) ; } ,
defaultLength = 1f ,
parameters = new List < Param > ( ) {
2023-07-13 00:35:47 +00:00
new Param ( "x" , new EntityTypes . Float ( - 10f , 10f , 0 ) , "Horizontal" , "How fast does the background move horizontally?" ) ,
new Param ( "y" , new EntityTypes . Float ( - 10f , 10f , 0 ) , "Vertical" , "How fast does the background move vertically?" ) ,
2023-06-06 18:59:56 +00:00
}
} ,
2023-05-28 17:34:44 +00:00
} ,
new List < string > ( ) { "agb" , "normal" } ,
"agbspacedance" , "jp" ,
new List < string > ( ) { "jp" }
) ;
2022-06-26 06:48:14 +00:00
}
}
}
namespace HeavenStudio.Games
{
2022-06-27 00:59:27 +00:00
// using Scripts_SpaceDance;
2022-06-26 06:48:14 +00:00
public class SpaceDance : Minigame
{
2023-02-27 20:13:10 +00:00
private static Color _defaultBGColor ;
public static Color defaultBGColor
{
get
{
2023-06-06 18:59:56 +00:00
ColorUtility . TryParseHtmlString ( "#0029D6" , out _defaultBGColor ) ;
2023-02-27 20:13:10 +00:00
return _defaultBGColor ;
}
}
public enum WhoSpeaks
{
Dancers = 0 ,
Gramps = 1 ,
Both = 2
}
2023-03-03 19:19:33 +00:00
public enum GrampsAnimationType
{
Stand = 0 ,
Talk = 1 ,
Sniff = 2
}
2023-02-27 20:13:10 +00:00
Tween bgColorTween ;
[SerializeField] SpriteRenderer bg ;
[SerializeField] Animator shootingStarAnim ;
2022-06-27 00:59:27 +00:00
public Animator DancerP ;
public Animator Dancer1 ;
public Animator Dancer2 ;
public Animator Dancer3 ;
public Animator Gramps ;
2022-06-27 16:07:27 +00:00
public Animator Hit ;
2022-06-27 00:59:27 +00:00
public GameObject Player ;
2023-06-06 18:59:56 +00:00
[NonSerialized] public bool shouldBop = true ;
2023-02-27 20:13:10 +00:00
bool canBop = true ;
bool grampsCanBop = true ;
public bool spaceGrampsShouldBop = false ;
float shootingStarLength ;
2023-06-10 19:17:06 +00:00
double shootingStarStartBeat ;
2023-02-27 20:13:10 +00:00
EasingFunction . Ease lastEase ;
bool isShootingStar ;
2023-03-03 19:19:33 +00:00
bool grampsLoopingAnim ;
bool grampsSniffing ;
2023-02-27 20:13:10 +00:00
2023-06-06 18:59:56 +00:00
[SerializeField] CanvasScroll scroll ;
2023-07-13 00:35:47 +00:00
float xScrollMultiplier = 0 ;
float yScrollMultiplier = 0 ;
[SerializeField] private float xBaseSpeed = 1 ;
[SerializeField] private float yBaseSpeed = 1 ;
2023-06-06 18:59:56 +00:00
2023-02-27 20:13:10 +00:00
public GameEvent bop = new GameEvent ( ) ;
2022-06-27 00:59:27 +00:00
2022-06-26 06:48:14 +00:00
public static SpaceDance instance ;
// Start is called before the first frame update
void Awake ( )
{
instance = this ;
}
// Update is called once per frame
void Update ( )
{
2023-02-27 20:13:10 +00:00
var cond = Conductor . instance ;
if ( cond . isPlaying & & ! cond . isPaused )
2022-06-26 06:48:14 +00:00
{
2023-07-13 00:35:47 +00:00
scroll . NormalizedX - = xBaseSpeed * xScrollMultiplier * Time . deltaTime ;
scroll . NormalizedY - = yBaseSpeed * yScrollMultiplier * Time . deltaTime ;
2023-02-27 20:13:10 +00:00
if ( cond . ReportBeat ( ref bop . lastReportedBeat , bop . startBeat % 1 ) )
{
2023-06-06 18:59:56 +00:00
if ( shouldBop )
2023-02-27 20:13:10 +00:00
{
Bop ( ) ;
}
2023-06-06 18:59:56 +00:00
if ( spaceGrampsShouldBop )
2023-02-27 20:13:10 +00:00
{
GrampsBop ( ) ;
}
}
if ( isShootingStar )
{
float normalizedBeat = cond . GetPositionFromBeat ( shootingStarStartBeat , shootingStarLength ) ;
if ( normalizedBeat > = 0 )
{
if ( normalizedBeat > 1 )
{
isShootingStar = false ;
}
else
{
EasingFunction . Function func = EasingFunction . GetEasingFunction ( lastEase ) ;
float newAnimPos = func ( 0f , 1f , normalizedBeat ) ;
shootingStarAnim . DoNormalizedAnimation ( "ShootingStar" , newAnimPos ) ;
}
}
}
if ( ! DancerP . IsPlayingAnimationName ( "PunchDo" ) & & ! DancerP . IsPlayingAnimationName ( "TurnRightDo" ) & & ! DancerP . IsPlayingAnimationName ( "SitDownDo" ) )
{
if ( PlayerInput . Pressed ( ) & & ! IsExpectingInputNow ( InputType . STANDARD_DOWN ) )
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputBad" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "PunchDo" , 0.5f ) ;
2023-06-06 18:59:56 +00:00
Gramps . Play ( "GrampsOhFuck" , 0 , 0 ) ;
2023-02-27 20:13:10 +00:00
}
if ( PlayerInput . GetSpecificDirectionDown ( 1 ) & & ! IsExpectingInputNow ( InputType . DIRECTION_RIGHT_DOWN ) )
{
DancerP . DoScaledAnimationAsync ( "TurnRightDo" , 0.5f ) ;
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputBad" ) ;
2023-06-06 18:59:56 +00:00
Gramps . Play ( "GrampsOhFuck" , 0 , 0 ) ;
2023-02-27 20:13:10 +00:00
}
if ( PlayerInput . GetSpecificDirectionDown ( 2 ) & & ! IsExpectingInputNow ( InputType . DIRECTION_DOWN_DOWN ) )
{
DancerP . DoScaledAnimationAsync ( "SitDownDo" , 0.5f ) ;
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputBad" ) ;
2023-06-06 18:59:56 +00:00
Gramps . Play ( "GrampsOhFuck" , 0 , 0 ) ;
2023-02-27 20:13:10 +00:00
}
}
2022-06-26 06:48:14 +00:00
}
}
2022-06-27 00:59:27 +00:00
2023-06-06 18:59:56 +00:00
public void UpdateScrollSpeed ( float scrollSpeedX , float scrollSpeedY )
{
2023-07-13 00:35:47 +00:00
xScrollMultiplier = scrollSpeedX ;
yScrollMultiplier = scrollSpeedY ;
2023-06-06 18:59:56 +00:00
}
2023-06-10 19:17:06 +00:00
public void GrampsAnimations ( double beat , int type , bool looping )
2023-03-03 19:19:33 +00:00
{
switch ( type )
{
case ( int ) GrampsAnimationType . Stand :
Gramps . Play ( "GrampsStand" , 0 , 0 ) ;
grampsLoopingAnim = false ;
grampsSniffing = false ;
break ;
case ( int ) GrampsAnimationType . Talk :
if ( looping )
{
grampsLoopingAnim = true ;
grampsSniffing = false ;
GrampsTalkLoop ( beat ) ;
}
else
{
grampsLoopingAnim = false ;
grampsSniffing = false ;
Gramps . DoScaledAnimationAsync ( "GrampsTalk" , 0.5f ) ;
}
break ;
case ( int ) GrampsAnimationType . Sniff :
if ( looping )
{
grampsLoopingAnim = true ;
grampsSniffing = true ;
GrampsSniffLoop ( beat ) ;
}
else
{
grampsLoopingAnim = false ;
grampsSniffing = false ;
Gramps . DoScaledAnimationAsync ( "GrampsSniff" , 0.5f ) ;
}
break ;
}
}
2023-06-10 19:17:06 +00:00
void GrampsSniffLoop ( double beat )
2023-03-03 19:19:33 +00:00
{
if ( ! grampsLoopingAnim | | ! grampsSniffing ) return ;
spaceGrampsShouldBop = false ;
BeatAction . New ( instance . gameObject , new List < BeatAction . Action > ( )
{
new BeatAction . Action ( beat , delegate
{
if ( grampsSniffing & & grampsLoopingAnim )
{
Gramps . DoScaledAnimationAsync ( "GrampsSniff" , 0.5f ) ;
}
} ) ,
new BeatAction . Action ( beat + 3 , delegate
{
if ( grampsSniffing & & grampsLoopingAnim )
{
Gramps . DoScaledAnimationAsync ( "GrampsSniff" , 0.5f ) ;
}
} ) ,
new BeatAction . Action ( beat + 3.5f , delegate
{
if ( grampsSniffing & & grampsLoopingAnim )
{
Gramps . DoScaledAnimationAsync ( "GrampsSniff" , 0.5f ) ;
}
} ) ,
new BeatAction . Action ( beat + 5.5f , delegate
{
GrampsSniffLoop ( beat + 5.5f ) ;
} ) ,
} ) ;
}
2023-06-10 19:17:06 +00:00
void GrampsTalkLoop ( double beat )
2023-03-03 19:19:33 +00:00
{
if ( ! grampsLoopingAnim | | grampsSniffing ) return ;
spaceGrampsShouldBop = false ;
BeatAction . New ( instance . gameObject , new List < BeatAction . Action > ( )
{
new BeatAction . Action ( beat + 0.66666f , delegate
{
if ( ! grampsSniffing & & grampsLoopingAnim )
{
Gramps . DoScaledAnimationAsync ( "GrampsTalk" , 0.5f ) ;
}
} ) ,
new BeatAction . Action ( beat + 1.33333f , delegate
{
if ( ! grampsSniffing & & grampsLoopingAnim )
{
Gramps . DoScaledAnimationAsync ( "GrampsTalk" , 0.5f ) ;
}
} ) ,
new BeatAction . Action ( beat + 2f , delegate
{
if ( ! grampsSniffing & & grampsLoopingAnim )
{
Gramps . DoScaledAnimationAsync ( "GrampsTalk" , 0.5f ) ;
}
} ) ,
new BeatAction . Action ( beat + 3f , delegate
{
if ( ! grampsSniffing & & grampsLoopingAnim )
{
Gramps . DoScaledAnimationAsync ( "GrampsTalk" , 0.5f ) ;
}
} ) ,
new BeatAction . Action ( beat + 3.5f , delegate
{
if ( ! grampsSniffing & & grampsLoopingAnim )
{
Gramps . DoScaledAnimationAsync ( "GrampsTalk" , 0.5f ) ;
}
} ) ,
new BeatAction . Action ( beat + 4f , delegate
{
GrampsTalkLoop ( beat + 4f ) ;
} ) ,
} ) ;
}
2023-06-10 19:17:06 +00:00
public void UpdateShootingStar ( double beat , float length , EasingFunction . Ease ease )
2022-06-27 00:59:27 +00:00
{
2023-06-10 19:17:06 +00:00
lastEase = ease ;
2023-02-27 20:13:10 +00:00
shootingStarLength = length ;
shootingStarStartBeat = beat ;
isShootingStar = true ;
}
2023-07-13 00:35:47 +00:00
public static void TurnRightSfx ( double beat , int whoSpeaks )
2023-02-27 20:13:10 +00:00
{
List < MultiSound . Sound > soundsToPlay = new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "spaceDance/voicelessTurn" , beat ) ,
} ;
switch ( whoSpeaks )
{
case ( int ) WhoSpeaks . Dancers :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "spaceDance/dancerTurn" , beat ) ,
2023-07-13 00:35:47 +00:00
new MultiSound . Sound ( "spaceDance/dancerRight" , beat + 1.0f , 1 , 1 , false , 0.012f ) ,
2023-02-27 20:13:10 +00:00
} ) ;
break ;
case ( int ) WhoSpeaks . Gramps :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "spaceDance/otherTurn" , beat ) ,
2023-07-13 00:35:47 +00:00
new MultiSound . Sound ( "spaceDance/otherRight" , beat + 1.0f , 1 , 1 , false , 0.005f ) ,
2023-02-27 20:13:10 +00:00
} ) ;
break ;
case ( int ) WhoSpeaks . Both :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "spaceDance/dancerTurn" , beat ) ,
2023-07-13 00:35:47 +00:00
new MultiSound . Sound ( "spaceDance/dancerRight" , beat + 1.0f , 1 , 1 , false , 0.012f ) ,
2023-02-27 20:13:10 +00:00
new MultiSound . Sound ( "spaceDance/otherTurn" , beat ) ,
2023-07-13 00:35:47 +00:00
new MultiSound . Sound ( "spaceDance/otherRight" , beat + 1.0f , 1 , 1 , false , 0.005f ) ,
2023-02-27 20:13:10 +00:00
} ) ;
break ;
}
MultiSound . Play ( soundsToPlay . ToArray ( ) ) ;
2023-07-13 00:35:47 +00:00
}
public void DoTurnRight ( double beat , bool grampsTurns )
{
canBop = false ;
if ( grampsTurns ) grampsCanBop = false ;
ScheduleInput ( beat , 1f , InputType . DIRECTION_RIGHT_DOWN , JustRight , RightMiss , Empty ) ;
2022-06-27 00:59:27 +00:00
BeatAction . New ( Player , new List < BeatAction . Action > ( )
2023-02-27 20:13:10 +00:00
{
new BeatAction . Action ( beat , delegate
2023-07-13 00:35:47 +00:00
{
DancerP . DoScaledAnimationAsync ( "TurnRightStart" , 0.5f ) ;
Dancer1 . DoScaledAnimationAsync ( "TurnRightStart" , 0.5f ) ;
Dancer2 . DoScaledAnimationAsync ( "TurnRightStart" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
Dancer3 . DoScaledAnimationAsync ( "TurnRightStart" , 0.5f ) ;
if ( grampsTurns ) Gramps . DoScaledAnimationAsync ( "GrampsTurnRightStart" , 0.5f ) ;
} ) ,
new BeatAction . Action ( beat + 1f , delegate
2022-06-27 00:59:27 +00:00
{
2023-07-13 00:35:47 +00:00
Dancer1 . DoScaledAnimationAsync ( "TurnRightDo" , 0.5f ) ;
Dancer2 . DoScaledAnimationAsync ( "TurnRightDo" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
Dancer3 . DoScaledAnimationAsync ( "TurnRightDo" , 0.5f ) ;
if ( grampsTurns ) Gramps . DoScaledAnimationAsync ( "GrampsTurnRightDo" , 0.5f ) ;
} ) ,
2023-06-06 18:59:56 +00:00
new BeatAction . Action ( beat + 1.5f , delegate { canBop = true ; grampsCanBop = true ; } ) ,
2023-02-27 20:13:10 +00:00
} ) ;
2022-06-27 00:59:27 +00:00
}
2023-07-13 00:35:47 +00:00
public static void SitDownSfx ( double beat , int whoSpeaks )
2022-06-27 00:59:27 +00:00
{
2023-02-27 20:13:10 +00:00
List < MultiSound . Sound > soundsToPlay = new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "spaceDance/voicelessSit" , beat ) ,
} ;
switch ( whoSpeaks )
{
case ( int ) WhoSpeaks . Dancers :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
2023-07-13 00:35:47 +00:00
new MultiSound . Sound ( "spaceDance/dancerLets" , beat , 1 , 1 , false , 0.055f ) ,
new MultiSound . Sound ( "spaceDance/dancerSit" , beat + 0.5f , 1 , 1 , false , 0.05f ) ,
new MultiSound . Sound ( "spaceDance/dancerDown" , beat + 1f , 1 , 1 , false , 0.004f ) ,
2023-02-27 20:13:10 +00:00
} ) ;
break ;
case ( int ) WhoSpeaks . Gramps :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
2023-07-13 00:35:47 +00:00
new MultiSound . Sound ( "spaceDance/otherLets" , beat , 1 , 1 , false , 0.02f ) ,
new MultiSound . Sound ( "spaceDance/otherSit" , beat + 0.5f , 1 , 1 , false , 0.064f ) ,
2023-03-03 04:23:56 +00:00
new MultiSound . Sound ( "spaceDance/otherDown" , beat + 1f , 1 , 1 , false , 0.01f ) ,
2023-02-27 20:13:10 +00:00
} ) ;
break ;
case ( int ) WhoSpeaks . Both :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
2023-07-13 00:35:47 +00:00
new MultiSound . Sound ( "spaceDance/dancerLets" , beat , 1 , 1 , false , 0.055f ) ,
new MultiSound . Sound ( "spaceDance/dancerSit" , beat + 0.5f , 1 , 1 , false , 0.05f ) ,
new MultiSound . Sound ( "spaceDance/dancerDown" , beat + 1f , 1 , 1 , false , 0.004f ) ,
new MultiSound . Sound ( "spaceDance/otherLets" , beat , 1 , 1 , false , 0.02f ) ,
new MultiSound . Sound ( "spaceDance/otherSit" , beat + 0.5f , 1 , 1 , false , 0.064f ) ,
2023-03-03 04:23:56 +00:00
new MultiSound . Sound ( "spaceDance/otherDown" , beat + 1f , 1 , 1 , false , 0.01f ) ,
2023-02-27 20:13:10 +00:00
} ) ;
break ;
}
MultiSound . Play ( soundsToPlay . ToArray ( ) ) ;
2023-07-13 00:35:47 +00:00
}
public void DoSitDown ( double beat , bool grampsSits )
{
canBop = false ;
if ( grampsSits ) grampsCanBop = false ;
ScheduleInput ( beat , 1f , InputType . DIRECTION_DOWN_DOWN , JustSit , SitMiss , Empty ) ;
2022-06-27 00:59:27 +00:00
BeatAction . New ( Player , new List < BeatAction . Action > ( )
2023-02-27 20:13:10 +00:00
{
new BeatAction . Action ( beat , delegate
2023-07-13 00:35:47 +00:00
{
DancerP . DoScaledAnimationAsync ( "SitDownStart" , 0.5f ) ;
Dancer1 . DoScaledAnimationAsync ( "SitDownStart" , 0.5f ) ;
Dancer2 . DoScaledAnimationAsync ( "SitDownStart" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
Dancer3 . DoScaledAnimationAsync ( "SitDownStart" , 0.5f ) ;
if ( grampsSits ) Gramps . DoScaledAnimationAsync ( "GrampsSitDownStart" , 0.5f ) ;
} ) ,
new BeatAction . Action ( beat + 1f , delegate
2023-07-13 00:35:47 +00:00
{
Dancer1 . DoScaledAnimationAsync ( "SitDownDo" , 0.5f ) ;
Dancer2 . DoScaledAnimationAsync ( "SitDownDo" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
Dancer3 . DoScaledAnimationAsync ( "SitDownDo" , 0.5f ) ;
if ( grampsSits ) Gramps . DoScaledAnimationAsync ( "GrampsSitDownDo" , 0.5f ) ;
} ) ,
2023-06-06 18:59:56 +00:00
new BeatAction . Action ( beat + 1.5f , delegate { canBop = true ; grampsCanBop = true ; } ) ,
2023-02-27 20:13:10 +00:00
} ) ;
2022-06-27 00:59:27 +00:00
}
2023-07-13 00:35:47 +00:00
public static void PunchSfx ( double beat , int whoSpeaks )
2022-06-27 00:59:27 +00:00
{
2023-02-27 20:13:10 +00:00
List < MultiSound . Sound > soundsToPlay = new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "spaceDance/voicelessPunch" , beat ) ,
new MultiSound . Sound ( "spaceDance/voicelessPunch" , beat + 0.5f ) ,
new MultiSound . Sound ( "spaceDance/voicelessPunch" , beat + 1f ) ,
} ;
switch ( whoSpeaks )
{
case ( int ) WhoSpeaks . Dancers :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "spaceDance/dancerPa" , beat ) ,
new MultiSound . Sound ( "spaceDance/dancerPa" , beat + 0.5f ) ,
new MultiSound . Sound ( "spaceDance/dancerPa" , beat + 1f ) ,
new MultiSound . Sound ( "spaceDance/dancerPunch" , beat + 1.5f ) ,
} ) ;
break ;
case ( int ) WhoSpeaks . Gramps :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "spaceDance/otherPa" , beat ) ,
new MultiSound . Sound ( "spaceDance/otherPa" , beat + 0.5f ) ,
new MultiSound . Sound ( "spaceDance/otherPa" , beat + 1f ) ,
new MultiSound . Sound ( "spaceDance/otherPunch" , beat + 1.5f ) ,
} ) ;
break ;
case ( int ) WhoSpeaks . Both :
soundsToPlay . AddRange ( new List < MultiSound . Sound > ( )
{
new MultiSound . Sound ( "spaceDance/dancerPa" , beat ) ,
new MultiSound . Sound ( "spaceDance/dancerPa" , beat + 0.5f ) ,
new MultiSound . Sound ( "spaceDance/dancerPa" , beat + 1f ) ,
new MultiSound . Sound ( "spaceDance/dancerPunch" , beat + 1.5f ) ,
new MultiSound . Sound ( "spaceDance/otherPa" , beat ) ,
new MultiSound . Sound ( "spaceDance/otherPa" , beat + 0.5f ) ,
new MultiSound . Sound ( "spaceDance/otherPa" , beat + 1f ) ,
new MultiSound . Sound ( "spaceDance/otherPunch" , beat + 1.5f ) ,
} ) ;
break ;
}
MultiSound . Play ( soundsToPlay . ToArray ( ) ) ;
2023-07-13 00:35:47 +00:00
}
public void DoPunch ( double beat , bool grampsPunches )
{
canBop = false ;
if ( grampsPunches ) grampsCanBop = false ;
ScheduleInput ( beat , 1.5f , InputType . STANDARD_DOWN , JustPunch , PunchMiss , Empty ) ;
2022-06-27 00:59:27 +00:00
BeatAction . New ( Player , new List < BeatAction . Action > ( )
{
2023-07-13 00:35:47 +00:00
new BeatAction . Action ( beat , delegate
{
DancerP . DoScaledAnimationAsync ( "PunchStartInner" , 0.5f ) ;
Dancer1 . DoScaledAnimationAsync ( "PunchStartInner" , 0.5f ) ;
Dancer2 . DoScaledAnimationAsync ( "PunchStartInner" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
Dancer3 . DoScaledAnimationAsync ( "PunchStartInner" , 0.5f ) ;
if ( grampsPunches ) Gramps . DoScaledAnimationAsync ( "GrampsPunchStartOdd" , 0.5f ) ;
} ) ,
2023-07-13 00:35:47 +00:00
new BeatAction . Action ( beat + 0.5f , delegate
{
DancerP . DoScaledAnimationAsync ( "PunchStartOuter" , 0.5f ) ;
Dancer1 . DoScaledAnimationAsync ( "PunchStartOuter" , 0.5f ) ;
Dancer2 . DoScaledAnimationAsync ( "PunchStartOuter" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
Dancer3 . DoScaledAnimationAsync ( "PunchStartOuter" , 0.5f ) ;
if ( grampsPunches ) Gramps . DoScaledAnimationAsync ( "GrampsPunchStartEven" , 0.5f ) ;
} ) ,
2023-07-13 00:35:47 +00:00
new BeatAction . Action ( beat + 1f , delegate
{
DancerP . DoScaledAnimationAsync ( "PunchStartInner" , 0.5f ) ;
Dancer1 . DoScaledAnimationAsync ( "PunchStartInner" , 0.5f ) ;
Dancer2 . DoScaledAnimationAsync ( "PunchStartInner" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
Dancer3 . DoScaledAnimationAsync ( "PunchStartInner" , 0.5f ) ;
if ( grampsPunches ) Gramps . DoScaledAnimationAsync ( "GrampsPunchStartOdd" , 0.5f ) ;
} ) ,
2023-07-13 00:35:47 +00:00
new BeatAction . Action ( beat + 1.5f , delegate
{
Dancer1 . DoScaledAnimationAsync ( "PunchDo" , 0.5f ) ;
Dancer2 . DoScaledAnimationAsync ( "PunchDo" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
Dancer3 . DoScaledAnimationAsync ( "PunchDo" , 0.5f ) ;
if ( grampsPunches ) Gramps . DoScaledAnimationAsync ( "GrampsPunchDo" , 0.5f ) ;
} ) ,
2023-07-13 00:35:47 +00:00
new BeatAction . Action ( beat + 2.5 , delegate
{
canBop = true ; grampsCanBop = true ;
} )
2022-06-27 00:59:27 +00:00
} ) ;
}
2023-06-10 19:17:06 +00:00
public void EpicBop ( double beat , float length , bool autoDancers , bool dancers , bool autoGramps , bool gramps )
2023-06-06 18:59:56 +00:00
{
shouldBop = autoDancers ;
spaceGrampsShouldBop = autoGramps ;
if ( dancers | | gramps )
{
List < BeatAction . Action > bops = new List < BeatAction . Action > ( ) ;
for ( int i = 0 ; i < length ; i + + )
{
if ( dancers )
{
bops . Add ( new BeatAction . Action ( beat + i , delegate { Bop ( ) ; } ) ) ;
}
if ( gramps )
{
bops . Add ( new BeatAction . Action ( beat + i , delegate { GrampsBop ( ) ; } ) ) ;
}
}
BeatAction . New ( instance . gameObject , bops ) ;
}
}
2023-02-27 20:13:10 +00:00
public void Bop ( )
2022-06-27 00:59:27 +00:00
{
2023-06-06 18:59:56 +00:00
if ( ! canBop ) return ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "Bop" , 0.5f ) ;
Dancer1 . DoScaledAnimationAsync ( "Bop" , 0.5f ) ;
Dancer2 . DoScaledAnimationAsync ( "Bop" , 0.5f ) ;
Dancer3 . DoScaledAnimationAsync ( "Bop" , 0.5f ) ;
}
2022-06-27 00:59:27 +00:00
2023-06-06 18:59:56 +00:00
public void GrampsBop ( )
2023-02-27 20:13:10 +00:00
{
2023-06-06 18:59:56 +00:00
if ( ! grampsCanBop ) return ;
Gramps . DoScaledAnimationAsync ( "GrampsBop" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
}
public void ChangeBackgroundColor ( Color color , float beats )
{
var seconds = Conductor . instance . secPerBeat * beats ;
if ( bgColorTween ! = null )
bgColorTween . Kill ( true ) ;
if ( seconds = = 0 )
{
bg . color = color ;
}
else
{
bgColorTween = bg . DOColor ( color , seconds ) ;
}
}
public void FadeBackgroundColor ( Color start , Color end , float beats , bool instant )
{
ChangeBackgroundColor ( start , 0f ) ;
if ( ! instant ) ChangeBackgroundColor ( end , beats ) ;
}
public void JustRight ( PlayerActionEvent caller , float state )
{
if ( state > = 1f | | state < = - 1f )
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputBad" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "TurnRightDo" , 0.5f ) ;
Gramps . DoScaledAnimationAsync ( "GrampsOhFuck" , 0.5f ) ;
return ;
}
RightSuccess ( ) ;
2022-06-27 00:59:27 +00:00
}
2023-02-27 20:13:10 +00:00
public void RightSuccess ( )
2022-06-27 00:59:27 +00:00
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputGood" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "TurnRightDo" , 0.5f ) ;
2022-06-27 00:59:27 +00:00
}
public void RightMiss ( PlayerActionEvent caller )
2023-02-27 20:13:10 +00:00
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputBad2" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "Ouch" , 0.5f ) ;
2022-06-27 16:07:27 +00:00
Hit . Play ( "HitTurn" , - 1 , 0 ) ;
2023-06-06 18:59:56 +00:00
Gramps . DoScaledAnimationAsync ( "GrampsMiss" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
}
2022-06-27 00:59:27 +00:00
2023-02-27 20:13:10 +00:00
public void JustSit ( PlayerActionEvent caller , float state )
{
if ( state > = 1f | | state < = - 1f )
2022-06-27 00:59:27 +00:00
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputBad" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "SitDownDo" , 0.5f ) ;
Gramps . DoScaledAnimationAsync ( "GrampsOhFuck" , 0.5f ) ;
return ;
}
SitSuccess ( ) ;
}
2022-06-27 00:59:27 +00:00
2023-02-27 20:13:10 +00:00
public void SitSuccess ( )
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputGood" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "SitDownDo" , 0.5f ) ;
}
2022-06-27 00:59:27 +00:00
public void SitMiss ( PlayerActionEvent caller )
2023-02-27 20:13:10 +00:00
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputBad2" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "Ouch" , 0.5f ) ;
2022-06-27 16:07:27 +00:00
Hit . Play ( "HitSit" , - 1 , 0 ) ;
2023-06-06 18:59:56 +00:00
Gramps . DoScaledAnimationAsync ( "GrampsMiss" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
}
2022-06-27 00:59:27 +00:00
2023-02-27 20:13:10 +00:00
public void JustPunch ( PlayerActionEvent caller , float state )
{
if ( state > = 1f | | state < = - 1f )
2022-06-27 00:59:27 +00:00
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputBad" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "PunchDo" , 0.5f ) ;
Gramps . DoScaledAnimationAsync ( "GrampsOhFuck" , 0.5f ) ;
return ;
}
PunchSuccess ( ) ;
}
2022-06-27 00:59:27 +00:00
2023-02-27 20:13:10 +00:00
public void PunchSuccess ( )
2022-06-27 00:59:27 +00:00
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputGood" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "PunchDo" , 0.5f ) ;
2022-06-27 00:59:27 +00:00
}
public void PunchMiss ( PlayerActionEvent caller )
2023-02-27 20:13:10 +00:00
{
2023-06-10 19:17:06 +00:00
SoundByte . PlayOneShotGame ( "spaceDance/inputBad2" ) ;
2023-02-27 20:13:10 +00:00
DancerP . DoScaledAnimationAsync ( "Ouch" , 0.5f ) ;
2022-06-27 16:07:27 +00:00
Hit . Play ( "HitPunch" , - 1 , 0 ) ;
2023-06-06 18:59:56 +00:00
Gramps . DoScaledAnimationAsync ( "GrampsMiss" , 0.5f ) ;
2023-02-27 20:13:10 +00:00
}
2022-06-27 00:59:27 +00:00
2023-02-27 20:13:10 +00:00
public void Empty ( PlayerActionEvent caller ) { }
2022-06-27 00:59:27 +00:00
2022-06-26 06:48:14 +00:00
}
}