2022-07-29 19:06:22 +00:00
using System ;
2021-12-29 06:52:48 +00:00
using System.Collections ;
using System.Collections.Generic ;
using UnityEngine ;
2022-03-14 14:21:05 +00:00
using HeavenStudio.Util ;
2023-06-10 19:13:29 +00:00
using Jukebox ;
2021-12-29 06:52:48 +00:00
2022-04-12 16:14:46 +00:00
namespace HeavenStudio.Games.Loaders
{
using static Minigames ;
2022-07-29 19:06:22 +00:00
public static class RvlNewKarateLoader
2022-04-12 16:14:46 +00:00
{
public static Minigame AddGame ( EventCaller eventCaller ) {
2023-04-02 02:28:23 +00:00
return new Minigame ( "karateman" , "Karate Man" , "fbca3e" , false , false , new List < GameAction > ( )
2022-04-12 16:14:46 +00:00
{
2022-08-20 23:03:51 +00:00
new GameAction ( "bop" , "Bop" )
{
2023-03-07 17:22:32 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . ToggleBop ( e . beat , e . length , e [ "toggle2" ] , e [ "toggle" ] ) ; } ,
resizable = true ,
2022-08-20 23:03:51 +00:00
parameters = new List < Param > ( )
2022-08-14 21:39:42 +00:00
{
2023-03-07 17:22:32 +00:00
new Param ( "toggle2" , true , "Bop" , "Whether to bop to the beat or not" ) ,
new Param ( "toggle" , false , "Bop (Auto)" , "Whether to auto bop to the beat or not" )
2022-08-14 21:39:42 +00:00
} ,
2022-08-21 23:46:45 +00:00
inactiveFunction = delegate { KarateMan . ToggleBopUnloaded ( eventCaller . currentEntity [ "toggle" ] ) ; }
2022-08-20 23:03:51 +00:00
} ,
new GameAction ( "hit" , "Toss Object" ) {
2023-04-23 20:17:21 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . CreateItem ( e . beat , e [ "type" ] , e [ "type2" ] , e [ "mute" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 2 ,
parameters = new List < Param > ( )
2022-07-29 19:06:22 +00:00
{
2022-08-15 00:47:13 +00:00
new Param ( "type" , KarateMan . HitType . Pot , "Object" , "The object to fire" ) ,
2023-04-23 20:17:21 +00:00
new Param ( "type2" , KarateMan . KarateManFaces . Normal , "Success Expression" , "The facial expression to set Joe to on hit" ) ,
new Param ( "mute" , false , "Mute" , "Should the throwing sound be muted?" )
2022-08-20 23:03:51 +00:00
}
} ,
new GameAction ( "bulb" , "Toss Lightbulb" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . CreateBulbSpecial ( e . beat , e [ "type" ] , e [ "colorA" ] , e [ "type2" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 2 ,
parameters = new List < Param > ( )
2022-07-29 19:06:22 +00:00
{
new Param ( "type" , KarateMan . LightBulbType . Normal , "Type" , "The preset bulb type. Yellow is used for kicks while Blue is used for combos" ) ,
2022-08-15 00:47:13 +00:00
new Param ( "colorA" , new Color ( 1f , 1f , 1f ) , "Custom Color" , "The color to use when the bulb type is set to Custom" ) ,
new Param ( "type2" , KarateMan . KarateManFaces . Normal , "Success Expression" , "The facial expression to set Joe to on hit" )
2022-08-20 23:03:51 +00:00
} ,
} ,
new GameAction ( "kick" , "Special: Kick" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . Kick ( e . beat , e [ "toggle" ] , e [ "type" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 4f ,
parameters = new List < Param > ( )
2022-08-15 00:47:13 +00:00
{
new Param ( "toggle" , false , "Contains Ball" , "Barrel contains a ball instead of a bomb?" ) ,
new Param ( "type" , KarateMan . KarateManFaces . Smirk , "Success Expression" , "The facial expression to set Joe to on hit" )
}
2022-08-20 23:03:51 +00:00
} ,
new GameAction ( "combo" , "Special: Combo" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . Combo ( e . beat , e [ "type" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 4 ,
parameters = new List < Param > ( )
2022-08-15 00:47:13 +00:00
{
new Param ( "type" , KarateMan . KarateManFaces . Happy , "Success Expression" , "The facial expression to set Joe to on hit" )
}
2022-08-20 23:03:51 +00:00
} ,
new GameAction ( "hitX" , "Warnings" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . DoWord ( e . beat , e [ "type" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 1f ,
parameters = new List < Param > ( )
2022-04-12 16:14:46 +00:00
{
2022-07-29 19:06:22 +00:00
new Param ( "type" , KarateMan . HitThree . HitThree , "Type" , "The warning text to show" )
2022-08-14 21:39:42 +00:00
} ,
2022-08-21 23:46:45 +00:00
inactiveFunction = delegate { var e = eventCaller . currentEntity ; KarateMan . DoWordSound ( e . beat , e [ "type" ] ) ; }
2022-08-20 23:03:51 +00:00
} ,
new GameAction ( "special camera" , "Special Camera" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . DoSpecialCamera ( e . beat , e . length , e [ "toggle" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 8f ,
resizable = true ,
parameters = new List < Param > ( )
2022-08-14 21:39:42 +00:00
{
new Param ( "toggle" , true , "Return Camera" , "Camera zooms back in?" ) ,
} ,
2022-08-21 23:46:45 +00:00
inactiveFunction = delegate { var e = eventCaller . currentEntity ; KarateMan . DoSpecialCamera ( e . beat , e . length , e [ "toggle" ] ) ; }
2022-08-20 23:03:51 +00:00
} ,
new GameAction ( "prepare" , "Preparation Stance" )
{
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . Prepare ( e . beat , e . length ) ; } ,
resizable = true
} ,
new GameAction ( "set gameplay modifiers" , "Gameplay Modifiers" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . SetGameplayMods ( e . beat , e [ "type" ] , e [ "toggle" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 0.5f ,
parameters = new List < Param > ( )
{
new Param ( "type" , KarateMan . NoriMode . None , "Flow Bar type" , "The type of Flow bar to use" ) ,
new Param ( "toggle" , true , "Enable Combos" , "Allow the player to combo? (Contextual combos will still be allowed even when off)" ) ,
}
} ,
new GameAction ( "set background effects" , "Background Appearance" )
2022-08-13 01:06:41 +00:00
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . SetBgAndShadowCol ( e . beat , e . length , e [ "type" ] , e [ "type2" ] , e [ "colorA" ] , e [ "colorB" ] , e [ "type3" ] ) ; KarateMan . instance . SetBgTexture ( e [ "type4" ] , e [ "type5" ] , e [ "colorC" ] , e [ "colorD" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 0.5f ,
resizable = true ,
parameters = new List < Param > ( )
2022-08-14 21:39:42 +00:00
{
new Param ( "type" , KarateMan . BackgroundType . Yellow , "Background Type" , "The preset background type" ) ,
new Param ( "type2" , KarateMan . ShadowType . Tinted , "Shadow Type" , "The shadow type. If Tinted doesn't work with your background color try Custom" ) ,
new Param ( "colorA" , new Color ( ) , "Custom Background Color" , "The background color to use when background type is set to Custom" ) ,
new Param ( "colorB" , new Color ( ) , "Custom Shadow Color" , "The shadow color to use when shadow type is set to Custom. When fading the background colour shadows fade to this color" ) ,
new Param ( "type3" , KarateMan . BackgroundFXType . None , "FX Type" , "The background effect to be displayed. Fade uses the entity length to determine colour fading speed" ) ,
new Param ( "type4" , KarateMan . BackgroundTextureType . Plain , "Texture" , "The type of background texture to use" ) ,
new Param ( "type5" , KarateMan . ShadowType . Tinted , "Color Filter Type" , "The method used to apply colour to the texture" ) ,
new Param ( "colorC" , new Color ( ) , "Custom Filter Color" , "The filter color to use when color filter type is set to Custom" ) ,
new Param ( "colorD" , new Color ( ) , "Fading Filter Color" , "When using the Fade background effect, make filter colour fade to this colour" ) ,
2022-04-12 16:14:46 +00:00
2022-08-14 21:39:42 +00:00
} ,
2022-08-21 23:46:45 +00:00
inactiveFunction = delegate { var e = eventCaller . currentEntity ; KarateMan . SetBgEffectsUnloaded ( e . beat , e . length , e [ "type" ] , e [ "type2" ] , e [ "colorA" ] , e [ "colorB" ] , e [ "type3" ] , e [ "type4" ] , e [ "type5" ] , e [ "colorC" ] , e [ "colorD" ] ) ; }
2022-08-20 23:03:51 +00:00
} ,
new GameAction ( "set object colors" , "Object Colors" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . UpdateMaterialColour ( e [ "colorA" ] , e [ "colorB" ] , e [ "colorC" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 0.5f ,
parameters = new List < Param > ( )
2022-08-14 21:39:42 +00:00
{
2022-08-16 02:45:48 +00:00
new Param ( "colorA" , new Color ( 1 , 1 , 1 , 1 ) , "Joe Body Color" , "The color to use for Karate Joe's body" ) ,
new Param ( "colorB" , new Color ( 0.81f , 0.81f , 0.81f , 1 ) , "Joe Highlight Color" , "The color to use for Karate Joe's highlights" ) ,
new Param ( "colorC" , new Color ( 1 , 1 , 1 , 1 ) , "Item Color" , "The color to use for the thrown items" ) ,
2022-08-14 21:39:42 +00:00
} ,
2022-08-21 23:46:45 +00:00
inactiveFunction = delegate { var e = eventCaller . currentEntity ; KarateMan . UpdateMaterialColour ( e [ "colorA" ] , e [ "colorB" ] , e [ "colorC" ] ) ; }
2022-08-20 23:03:51 +00:00
} ,
new GameAction ( "particle effects" , "Particle Effects" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . SetParticleEffect ( e . beat , e [ "type" ] , e [ "valA" ] , e [ "valB" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 0.5f ,
parameters = new List < Param > ( )
{
new Param ( "type" , KarateMan . ParticleType . None , "Particle Type" , "The type of particle effect to spawn. Using \"None\" will stop all effects" ) ,
new Param ( "valA" , new EntityTypes . Float ( 0f , 64f , 1f ) , "Wind Strength" , "The strength of the particle wind" ) ,
new Param ( "valB" , new EntityTypes . Float ( 1f , 16f , 1f ) , "Particle Intensity" , "The intensity of the particle effect" )
}
} ,
new GameAction ( "force facial expression" , "Set Facial Expression" )
{
2022-08-21 23:46:45 +00:00
function = delegate { KarateMan . instance . SetFaceExpression ( eventCaller . currentEntity [ "type" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 0.5f ,
parameters = new List < Param > ( )
{
new Param ( "type" , KarateMan . KarateManFaces . Normal , "Facial Expression" , "The facial expression to force Joe to. Special moves may override this" )
}
} ,
2022-07-29 19:06:22 +00:00
2022-04-12 16:14:46 +00:00
// These are still here for backwards-compatibility but are hidden in the editor
2022-08-20 23:03:51 +00:00
new GameAction ( "pot" , "" )
{
function = delegate { KarateMan . instance . CreateItem ( eventCaller . currentEntity . beat , 0 , ( int ) KarateMan . HitType . Pot ) ; } ,
defaultLength = 2 ,
hidden = true
} ,
new GameAction ( "rock" , "" )
{
function = delegate { KarateMan . instance . CreateItem ( eventCaller . currentEntity . beat , 0 , ( int ) KarateMan . HitType . Rock ) ; } ,
defaultLength = 2 ,
hidden = true
} ,
new GameAction ( "ball" , "" )
{
function = delegate { KarateMan . instance . CreateItem ( eventCaller . currentEntity . beat , 0 , ( int ) KarateMan . HitType . Ball ) ; } ,
defaultLength = 2 ,
hidden = true
} ,
new GameAction ( "tacobell" , "" )
{
function = delegate { KarateMan . instance . CreateItem ( eventCaller . currentEntity . beat , 0 , ( int ) KarateMan . HitType . TacoBell ) ; } ,
defaultLength = 2 ,
hidden = true
} ,
new GameAction ( "bgfxon" , "" )
{
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . SetBgFx ( ( int ) KarateMan . BackgroundFXType . Sunburst , e . beat , e . length ) ; } ,
hidden = true
} ,
new GameAction ( "bgfxoff" , "" )
{
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . SetBgFx ( ( int ) KarateMan . BackgroundFXType . None , e . beat , e . length ) ; } ,
hidden = true
} ,
new GameAction ( "hit3" , "" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . DoWord ( e . beat , e [ "type" ] ) ; } ,
2022-08-20 23:03:51 +00:00
parameters = new List < Param > ( )
2022-07-29 19:06:22 +00:00
{
new Param ( "type" , KarateMan . HitThree . HitThree , "Type" , "The warning text to show" )
} ,
2022-08-20 23:03:51 +00:00
hidden = true
} ,
new GameAction ( "hit4" , "" )
{
function = delegate { KarateMan . instance . DoWord ( eventCaller . currentEntity . beat , ( int ) KarateMan . HitThree . HitFour ) ; } ,
hidden = true
} ,
new GameAction ( "set background color" , "" )
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . SetBgAndShadowCol ( e . beat , e . length , e [ "type" ] , e [ "type2" ] , e [ "colorA" ] , e [ "colorB" ] , ( int ) KarateMan . currentBgEffect ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 0.5f ,
parameters = new List < Param > ( )
2022-07-29 19:06:22 +00:00
{
new Param ( "type" , KarateMan . BackgroundType . Yellow , "Background Type" , "The preset background type" ) ,
new Param ( "type2" , KarateMan . ShadowType . Tinted , "Shadow Type" , "The shadow type. If Tinted doesn't work with your background color try Custom" ) ,
new Param ( "colorA" , new Color ( ) , "Custom Background Color" , "The background color to use when background type is set to Custom" ) ,
new Param ( "colorB" , new Color ( ) , "Custom Shadow Color" , "The shadow color to use when shadow type is set to Custom" ) ,
2022-08-03 20:14:37 +00:00
} ,
2022-08-20 23:03:51 +00:00
hidden = true
} ,
new GameAction ( "set background fx" , "" )
2022-07-10 02:42:28 +00:00
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . SetBgFx ( e [ "type" ] , e . beat , e . length ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 0.5f ,
parameters = new List < Param > ( )
{
new Param ( "type" , KarateMan . BackgroundFXType . None , "FX Type" , "The background effect to be displayed" )
} ,
hidden = true
2022-07-10 02:42:28 +00:00
} ,
2022-04-12 16:14:46 +00:00
2022-08-20 23:03:51 +00:00
new GameAction ( "set background texture" , "" )
2022-08-12 03:39:30 +00:00
{
2022-08-21 23:46:45 +00:00
function = delegate { var e = eventCaller . currentEntity ; KarateMan . instance . SetBgTexture ( e [ "type" ] , e [ "type2" ] , e [ "colorA" ] , e [ "colorB" ] ) ; } ,
2022-08-20 23:03:51 +00:00
defaultLength = 0.5f ,
parameters = new List < Param > ( )
{
new Param ( "type" , KarateMan . BackgroundTextureType . Plain , "Texture" , "The type of background texture to use" ) ,
new Param ( "type2" , KarateMan . ShadowType . Tinted , "Color Filter Type" , "The method used to apply colour to the texture" ) ,
new Param ( "colorA" , new Color ( ) , "Custom Filter Color" , "The filter color to use when color filter type is set to Custom" ) ,
new Param ( "colorB" , new Color ( ) , "Fading Filter Color" , "When using the Fade background effect, make filter colour fade to this colour" ) ,
} ,
hidden = true
2022-08-12 03:39:30 +00:00
} ,
2022-08-14 22:59:28 +00:00
} ,
new List < string > ( ) { "agb" , "ntr" , "rvl" , "ctr" , "pco" , "normal" } ,
"karate" , "en" ,
new List < string > ( ) { "en" }
) ;
2022-04-12 16:14:46 +00:00
}
}
}
2022-03-14 14:21:05 +00:00
namespace HeavenStudio.Games
2021-12-29 06:52:48 +00:00
{
2022-03-12 04:10:13 +00:00
using Scripts_KarateMan ;
2021-12-29 06:52:48 +00:00
public class KarateMan : Minigame
{
2022-07-29 19:06:22 +00:00
public static KarateMan instance ;
2022-03-01 08:17:06 +00:00
public enum HitType
{
Pot = 0 ,
2022-07-29 19:06:22 +00:00
Lightbulb = 1 ,
2022-03-01 08:17:06 +00:00
Rock = 2 ,
Ball = 3 ,
2022-03-03 04:23:20 +00:00
CookingPot = 6 ,
Alien = 7 ,
2022-08-15 00:47:13 +00:00
Bomb = 8 ,
2022-03-03 04:23:20 +00:00
TacoBell = 999
2022-03-01 08:17:06 +00:00
}
2022-03-03 21:16:06 +00:00
public enum HitThree
{
HitTwo ,
HitThree ,
HitThreeAlt ,
2022-07-29 19:06:22 +00:00
HitFour ,
Grr ,
Warning ,
Combo ,
HitOne ,
2022-03-03 21:16:06 +00:00
}
2022-02-26 06:31:35 +00:00
public enum LightBulbType
{
2022-02-26 18:57:09 +00:00
Normal ,
Blue ,
Yellow ,
Custom
2022-02-26 06:31:35 +00:00
}
2022-02-26 18:27:02 +00:00
public enum BackgroundType
2022-02-26 06:31:35 +00:00
{
2022-02-26 18:57:09 +00:00
Yellow ,
2022-02-27 23:46:32 +00:00
Fuchsia ,
2022-02-26 18:57:09 +00:00
Blue ,
Red ,
Orange ,
Pink ,
Custom
2022-02-26 18:27:02 +00:00
}
2022-03-01 17:40:59 +00:00
public enum BackgroundFXType
{
None ,
2022-03-01 20:37:06 +00:00
Sunburst ,
2022-07-29 19:06:22 +00:00
Rings ,
Fade
2022-03-01 17:40:59 +00:00
}
2022-08-06 01:19:18 +00:00
public enum BackgroundTextureType
{
Plain ,
Gradient ,
2022-08-06 02:37:06 +00:00
Radial ,
2022-08-06 01:19:18 +00:00
Blood ,
//ManMan?
}
2022-02-27 17:02:46 +00:00
public enum ShadowType
{
Tinted ,
Custom
}
2022-08-03 21:49:32 +00:00
public enum CameraAngle
{
Normal ,
Special
}
2022-08-06 01:19:18 +00:00
public enum ParticleType
{
None ,
Snow ,
Fire ,
Rain
}
2022-08-06 02:37:06 +00:00
public enum KarateManFaces
{
Normal ,
Smirk ,
Surprise ,
Sad ,
Lenny ,
Happy ,
VerySad ,
Blush
}
2022-08-06 01:19:18 +00:00
2022-08-13 01:06:41 +00:00
public enum NoriMode
{
None ,
Tengoku ,
Mania ,
}
2022-08-14 21:39:42 +00:00
public static bool IsComboEnable = true ; //only stops Out combo inputs, this basically makes combo contextual
2022-08-13 01:06:41 +00:00
public bool IsNoriActive { get { return Nori . MaxNori > 0 ; } }
public float NoriPerformance { get { if ( IsNoriActive ) return Nori . Nori / Nori . MaxNori ; else return 1f ; } }
2022-02-26 18:57:09 +00:00
public Color [ ] LightBulbColors ;
2022-02-26 18:27:02 +00:00
public Color [ ] BackgroundColors ;
2022-02-27 17:02:46 +00:00
public Color [ ] ShadowColors ;
2022-07-29 19:06:22 +00:00
//camera positions (normal, special)
2022-08-06 01:19:18 +00:00
[Header("Camera Positions")]
2022-07-29 19:06:22 +00:00
public Transform [ ] CameraPosition ;
Vector3 cameraPosition ;
2023-06-10 19:13:29 +00:00
static double startCamSpecial = double . MinValue ;
static double wantsReturn = double . MinValue ;
2022-08-14 22:59:28 +00:00
static float cameraReturnLength = 0f ;
2022-08-14 21:39:42 +00:00
static CameraAngle cameraAngle = CameraAngle . Normal ;
2021-12-30 12:17:22 +00:00
2022-07-29 19:06:22 +00:00
//pot trajectory stuff
2022-08-06 01:19:18 +00:00
[Header("References")]
2022-07-29 19:06:22 +00:00
public Transform ItemHolder ;
public GameObject Item ;
public KarateManJoe Joe ;
2022-08-13 01:06:41 +00:00
public GameObject NoriGO ;
public KarateManNoriController Nori ;
2022-01-03 22:42:43 +00:00
2022-08-11 23:36:47 +00:00
[Header("Colour Map")]
public Material MappingMaterial ;
2022-08-14 22:59:28 +00:00
public static Color BodyColor = Color . white ;
2023-03-27 02:26:01 +00:00
public static Color HighlightColor = new Color ( 0.81f , 0.81f , 0.81f , 1 ) ;
2022-08-14 22:59:28 +00:00
public static Color ItemColor = Color . white ;
2022-08-11 23:36:47 +00:00
2022-08-06 01:19:18 +00:00
[Header("Word")]
2022-07-29 19:06:22 +00:00
public Animator Word ;
2023-06-10 19:13:29 +00:00
static double wordClearTime = double . MinValue ;
2022-07-29 19:06:22 +00:00
const float hitVoiceOffset = 0.042f ;
2021-12-30 12:17:22 +00:00
2022-08-06 01:19:18 +00:00
[Header("Backgrounds")]
2022-08-14 21:39:42 +00:00
static int bgType = ( int ) BackgroundType . Yellow ;
public static int currentBgEffect = ( int ) BackgroundFXType . None ;
2023-06-10 19:13:29 +00:00
static double bgFadeTime = double . MinValue ;
2022-08-14 21:39:42 +00:00
static float bgFadeDuration = 0f ;
static Color bgColour = Color . white ;
2022-07-31 01:16:48 +00:00
public SpriteRenderer BGPlane ;
2022-08-03 21:49:32 +00:00
public GameObject BGEffect ;
2022-08-06 23:15:44 +00:00
Color bgColourLast ;
2022-08-06 01:19:18 +00:00
2022-08-03 21:49:32 +00:00
Animator bgEffectAnimator ;
SpriteRenderer bgEffectSpriteRenderer ;
2022-07-31 01:16:48 +00:00
2022-08-14 21:39:42 +00:00
static int textureType = ( int ) BackgroundTextureType . Plain ;
static int textureFilterType = ( int ) ShadowType . Tinted ;
static Color filterColour = Color . white ;
static Color filterColourNext = Color . white ;
2022-08-06 01:19:18 +00:00
public GameObject BGGradient ;
SpriteRenderer bgGradientRenderer ;
2022-08-13 03:33:50 +00:00
public GameObject BGBlood ;
SpriteRenderer bgBloodRenderer ;
2022-08-14 20:29:39 +00:00
public GameObject BGRadial ;
SpriteRenderer bgRadialRenderer ;
2022-08-06 01:19:18 +00:00
[Header("Shadows")]
2022-08-14 21:39:42 +00:00
static int currentShadowType = ( int ) ShadowType . Tinted ;
static Color customShadowColour = Color . white ;
static Color oldShadowColour ;
2022-08-03 22:55:13 +00:00
2022-08-06 01:19:18 +00:00
[Header("Particles")]
//wind
public WindZone Wind ;
//snow
public ParticleSystem SnowEffect ;
public GameObject SnowEffectGO ;
//fire
public ParticleSystem FireEffect ;
public GameObject FireEffectGO ;
//rain
public ParticleSystem RainEffect ;
public GameObject RainEffectGO ;
2022-08-14 21:39:42 +00:00
[Header("Unloaded Game Calls")]
2022-08-15 00:47:13 +00:00
//public static Queue<Beatmap.Entity> ItemQueue = new Queue<Beatmap.Entity>();
2022-08-14 21:39:42 +00:00
public static bool WantBop = true ;
public static bool WantNori = true ;
public static int WantNoriType = ( int ) NoriMode . None ;
2023-06-10 19:13:29 +00:00
public static double WantBgChangeStart = double . MinValue ;
2022-08-14 21:39:42 +00:00
public static float WantBgChangeLength = 0f ;
2021-12-29 06:52:48 +00:00
private void Awake ( )
{
instance = this ;
2022-07-29 19:06:22 +00:00
KarateManPot . ResetLastCombo ( ) ;
cameraPosition = CameraPosition [ 0 ] . position ;
2022-02-26 18:27:02 +00:00
}
2023-06-10 19:13:29 +00:00
public override void OnPlay ( double beat )
2022-09-18 20:48:14 +00:00
{
var cond = Conductor . instance ;
if ( ! cond . isPlaying )
{
SetBgEffectsToLast ( beat ) ;
// remove all children of the ItemHolder
foreach ( Transform child in ItemHolder )
{
Destroy ( child . gameObject ) ;
}
}
}
2022-07-29 19:06:22 +00:00
private void Start ( )
2022-02-26 18:27:02 +00:00
{
2022-09-18 20:48:14 +00:00
var cond = Conductor . instance ;
2022-07-29 19:06:22 +00:00
GameCamera . additionalPosition = cameraPosition - GameCamera . defaultPosition ;
2022-08-03 21:49:32 +00:00
bgEffectAnimator = BGEffect . GetComponent < Animator > ( ) ;
bgEffectSpriteRenderer = BGEffect . GetComponent < SpriteRenderer > ( ) ;
2022-08-03 22:55:13 +00:00
2022-08-06 01:19:18 +00:00
bgGradientRenderer = BGGradient . GetComponent < SpriteRenderer > ( ) ;
2022-08-13 03:33:50 +00:00
bgBloodRenderer = BGBlood . GetComponent < SpriteRenderer > ( ) ;
2022-08-14 20:29:39 +00:00
bgRadialRenderer = BGRadial . GetComponent < SpriteRenderer > ( ) ;
2022-08-06 01:19:18 +00:00
2023-06-10 19:13:29 +00:00
SetBgEffectsToLast ( cond . songPositionInBeatsAsDouble ) ;
2022-09-18 20:48:14 +00:00
SetBgAndShadowCol ( WantBgChangeStart , WantBgChangeLength , bgType , ( int ) currentShadowType , bgColour , customShadowColour , ( int ) currentBgEffect ) ;
2022-08-14 21:39:42 +00:00
SetBgTexture ( textureType , textureFilterType , filterColour , filterColour ) ;
2022-08-11 23:36:47 +00:00
UpdateMaterialColour ( BodyColor , HighlightColor , ItemColor ) ;
2023-03-07 17:22:32 +00:00
ToggleBop ( 0 , 0 , false , WantBop ) ;
2021-12-29 06:52:48 +00:00
}
2022-07-29 19:06:22 +00:00
private void Update ( )
2022-01-20 01:48:52 +00:00
{
2022-08-03 21:49:32 +00:00
var cond = Conductor . instance ;
2022-08-07 23:40:06 +00:00
if ( ! cond . isPlaying )
2023-06-10 19:13:29 +00:00
SetBgEffectsToLast ( cond . songPositionInBeatsAsDouble ) ;
2022-08-07 23:40:06 +00:00
2022-08-03 21:49:32 +00:00
switch ( currentBgEffect )
{
2022-08-14 21:39:42 +00:00
case ( int ) BackgroundFXType . Sunburst :
2022-08-03 21:49:32 +00:00
bgEffectAnimator . DoNormalizedAnimation ( "Sunburst" , ( cond . songPositionInBeats * 0.5f ) % 1f ) ;
break ;
2022-08-14 21:39:42 +00:00
case ( int ) BackgroundFXType . Rings :
2022-08-03 21:49:32 +00:00
bgEffectAnimator . DoNormalizedAnimation ( "Rings" , ( cond . songPositionInBeats * 0.5f ) % 1f ) ;
break ;
default :
bgEffectAnimator . Play ( "NoPose" , - 1 , 0 ) ;
break ;
}
2023-06-10 19:13:29 +00:00
if ( cond . songPositionInBeatsAsDouble > = wordClearTime )
2022-01-20 01:48:52 +00:00
{
2022-07-29 19:06:22 +00:00
Word . Play ( "NoPose" ) ;
2022-01-20 01:48:52 +00:00
}
2022-08-03 21:49:32 +00:00
2023-06-10 19:13:29 +00:00
if ( cond . songPositionInBeatsAsDouble > = startCamSpecial & & cond . songPositionInBeatsAsDouble < = wantsReturn )
2022-08-03 21:49:32 +00:00
{
float camX = 0f ;
float camY = 0f ;
float camZ = 0f ;
2023-06-10 19:13:29 +00:00
if ( cond . songPositionInBeatsAsDouble < = startCamSpecial + cameraReturnLength )
2022-08-03 21:49:32 +00:00
{
2022-08-06 01:19:18 +00:00
float prog = cond . GetPositionFromBeat ( startCamSpecial , cameraReturnLength ) ;
2023-06-10 19:13:29 +00:00
camX = Util . EasingFunction . EaseOutCubic ( CameraPosition [ 0 ] . position . x , CameraPosition [ 1 ] . position . x , prog ) ;
camY = Util . EasingFunction . EaseOutCubic ( CameraPosition [ 0 ] . position . y , CameraPosition [ 1 ] . position . y , prog ) ;
camZ = Util . EasingFunction . EaseOutCubic ( CameraPosition [ 0 ] . position . z , CameraPosition [ 1 ] . position . z , prog ) ;
2022-08-03 21:49:32 +00:00
cameraPosition = new Vector3 ( camX , camY , camZ ) ;
}
2023-06-10 19:13:29 +00:00
else if ( cond . songPositionInBeatsAsDouble > = wantsReturn - cameraReturnLength )
2022-08-03 21:49:32 +00:00
{
2022-08-06 01:19:18 +00:00
float prog = cond . GetPositionFromBeat ( wantsReturn - cameraReturnLength , cameraReturnLength ) ;
2023-06-10 19:13:29 +00:00
camX = Util . EasingFunction . EaseOutQuad ( CameraPosition [ 1 ] . position . x , CameraPosition [ 0 ] . position . x , prog ) ;
camY = Util . EasingFunction . EaseOutQuad ( CameraPosition [ 1 ] . position . y , CameraPosition [ 0 ] . position . y , prog ) ;
camZ = Util . EasingFunction . EaseOutQuad ( CameraPosition [ 1 ] . position . z , CameraPosition [ 0 ] . position . z , prog ) ;
2022-08-03 21:49:32 +00:00
cameraPosition = new Vector3 ( camX , camY , camZ ) ;
}
else
{
cameraPosition = CameraPosition [ 1 ] . position ;
}
}
else
{
2022-08-06 01:19:18 +00:00
if ( cameraAngle = = CameraAngle . Special )
cameraAngle = CameraAngle . Normal ;
2022-08-03 21:49:32 +00:00
cameraPosition = CameraPosition [ 0 ] . position ;
}
2022-08-06 23:15:44 +00:00
float fadeProg = cond . GetPositionFromBeat ( bgFadeTime , bgFadeDuration ) ;
2023-06-10 19:13:29 +00:00
if ( bgFadeTime ! = double . MinValue & & fadeProg > = 0 )
2022-08-06 23:15:44 +00:00
{
if ( fadeProg > = 1f )
{
2023-06-10 19:13:29 +00:00
bgFadeTime = double . MinValue ;
2022-08-06 23:15:44 +00:00
bgFadeDuration = 0f ;
BGPlane . color = bgColour ;
filterColour = filterColourNext ;
UpdateFilterColour ( bgColour , filterColour ) ;
oldShadowColour = GetShadowColor ( true ) ;
}
else
{
Color col = Color . LerpUnclamped ( bgColourLast , bgColour , fadeProg ) ;
BGPlane . color = col ;
UpdateFilterColour ( col , Color . LerpUnclamped ( filterColour , filterColourNext , fadeProg ) ) ;
}
}
2022-08-03 21:49:32 +00:00
GameCamera . additionalPosition = cameraPosition - GameCamera . defaultPosition ;
BGEffect . transform . position = new Vector3 ( GameCamera . instance . transform . position . x , GameCamera . instance . transform . position . y , 0 ) ;
}
2023-06-10 19:13:29 +00:00
static List < RiqEntity > allHits = new List < RiqEntity > ( ) ;
static List < RiqEntity > allEnds = new List < RiqEntity > ( ) ;
public static int CountHitsToEnd ( double fromBeat )
2022-08-13 22:38:22 +00:00
{
allHits = EventCaller . GetAllInGameManagerList ( "karateman" , new string [ ] { "hit" , "bulb" , "kick" , "combo" } ) ;
allEnds = EventCaller . GetAllInGameManagerList ( "gameManager" , new string [ ] { "switchGame" , "end" } ) ;
allHits . Sort ( ( x , y ) = > x . beat . CompareTo ( y . beat ) ) ;
allEnds . Sort ( ( x , y ) = > x . beat . CompareTo ( y . beat ) ) ;
2023-06-10 19:13:29 +00:00
double endBeat = double . MaxValue ;
2022-08-13 22:38:22 +00:00
//get the beat of the closest end event
2022-08-21 23:46:45 +00:00
foreach ( var end in allEnds )
2022-08-13 22:38:22 +00:00
{
if ( end . beat > fromBeat )
{
endBeat = end . beat ;
break ;
}
}
//count each hit event beginning from our current beat to the beat of the closest game switch or end
// this still counts hits even if they happen after a switch / end!!!
int count = 0 ;
string type ;
for ( int i = 0 ; i < allHits . Count ; i + + )
{
2022-08-21 23:46:45 +00:00
var h = allHits [ i ] ;
2022-08-13 22:38:22 +00:00
if ( h . beat > = fromBeat )
{
if ( h . beat < endBeat )
{
//kicks and combos count for 2 hits
type = ( h . datamodel . Split ( '/' ) ) [ 1 ] ;
count + = ( type = = "kick" | | type = = "combo" ? 2 : 1 ) ;
}
else
break ;
}
}
return count ;
}
2023-06-10 19:13:29 +00:00
public static void DoSpecialCamera ( double beat , float length , bool returns )
2022-08-03 21:49:32 +00:00
{
2022-08-06 01:19:18 +00:00
if ( cameraAngle = = CameraAngle . Normal )
{
startCamSpecial = beat ;
cameraAngle = CameraAngle . Special ;
}
2023-06-10 19:13:29 +00:00
wantsReturn = returns ? beat + length - 0.001f : double . MaxValue ;
2022-08-06 01:19:18 +00:00
cameraReturnLength = Mathf . Min ( 2f , length * 0.5f ) ;
2022-01-20 01:48:52 +00:00
}
2023-06-10 19:13:29 +00:00
public void DoWord ( double beat , int type , bool doSound = true )
2022-08-14 21:39:42 +00:00
{
Word . Play ( DoWordSound ( beat , type , doSound ) ) ;
}
2023-06-10 19:13:29 +00:00
public static string DoWordSound ( double beat , int type , bool doSound = true )
2021-12-30 12:17:22 +00:00
{
2022-08-07 23:40:06 +00:00
String word = "NoPose" ;
2023-06-10 19:13:29 +00:00
double clear = 0f ;
2022-07-29 19:06:22 +00:00
switch ( type )
2021-12-30 12:17:22 +00:00
{
2022-07-29 19:06:22 +00:00
case ( int ) HitThree . HitTwo :
2022-08-07 23:40:06 +00:00
word = "Word02" ;
clear = beat + 4f ;
if ( doSound )
MultiSound . Play ( new MultiSound . Sound [ ]
{
new MultiSound . Sound ( "karateman/hit" , beat + 0.5f , offset : hitVoiceOffset ) ,
new MultiSound . Sound ( "karateman/two" , beat + 1f ) ,
} , forcePlay : true ) ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitThree . HitThree :
2022-08-07 23:40:06 +00:00
word = "Word03" ;
clear = beat + 4f ;
if ( doSound )
MultiSound . Play ( new MultiSound . Sound [ ]
{
new MultiSound . Sound ( "karateman/hit" , beat + 0.5f , offset : hitVoiceOffset ) ,
new MultiSound . Sound ( "karateman/three" , beat + 1f ) ,
} , forcePlay : true ) ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitThree . HitThreeAlt :
2022-08-07 23:40:06 +00:00
word = "Word03" ;
clear = beat + 4f ;
if ( doSound )
MultiSound . Play ( new MultiSound . Sound [ ]
{
new MultiSound . Sound ( "karateman/hitAlt" , beat + 0.5f , offset : hitVoiceOffset ) ,
new MultiSound . Sound ( "karateman/threeAlt" , beat + 1f ) ,
} , forcePlay : true ) ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitThree . HitFour :
2022-08-07 23:40:06 +00:00
word = "Word04" ;
clear = beat + 4f ;
if ( doSound )
MultiSound . Play ( new MultiSound . Sound [ ]
{
new MultiSound . Sound ( "karateman/hit" , beat + 0.5f , offset : hitVoiceOffset ) ,
new MultiSound . Sound ( "karateman/four" , beat + 1f ) ,
} , forcePlay : true ) ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitThree . Grr :
2022-08-07 23:40:06 +00:00
word = "Word01" ;
clear = beat + 1f ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitThree . Warning :
2022-08-07 23:40:06 +00:00
word = "Word05" ;
clear = beat + 1f ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitThree . Combo :
2022-08-07 23:40:06 +00:00
word = "Word00" ;
clear = beat + 3f ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitThree . HitOne : //really?
2022-08-07 23:40:06 +00:00
word = "Word06" ;
clear = beat + 4f ;
if ( doSound )
MultiSound . Play ( new MultiSound . Sound [ ]
{
new MultiSound . Sound ( "karateman/hit" , beat + 0.5f , offset : hitVoiceOffset ) ,
new MultiSound . Sound ( "karateman/one" , beat + 1f ) ,
} , forcePlay : true ) ;
2022-07-29 19:06:22 +00:00
break ;
2022-02-14 13:48:41 +00:00
}
2023-06-10 19:13:29 +00:00
if ( Conductor . instance . songPositionInBeatsAsDouble < = clear & & Conductor . instance . songPositionInBeatsAsDouble > = beat )
2022-08-07 23:40:06 +00:00
{
wordClearTime = clear ;
}
2022-08-14 21:39:42 +00:00
return word ;
2021-12-30 12:17:22 +00:00
}
2023-06-10 19:13:29 +00:00
public void CreateItem ( double beat , int type , int expression , bool muteSound = false )
2021-12-30 12:17:22 +00:00
{
2022-03-01 20:37:06 +00:00
2022-07-29 19:06:22 +00:00
string outSound ;
2023-06-10 19:13:29 +00:00
if ( ( beat + 0.5f ) % 1.0 = = 0f )
2022-07-29 19:06:22 +00:00
outSound = "karateman/offbeatObjectOut" ;
2022-03-01 17:40:59 +00:00
else
2022-07-29 19:06:22 +00:00
outSound = "karateman/objectOut" ;
switch ( type )
2022-03-01 17:40:59 +00:00
{
2022-07-29 19:06:22 +00:00
case ( int ) HitType . Pot :
2022-08-15 00:47:13 +00:00
CreateItemInstance ( beat , "Item00" , expression ) ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitType . Lightbulb :
2023-06-10 19:13:29 +00:00
if ( ( beat + 0.5f ) % 1.0 = = 0f )
2022-07-29 19:06:22 +00:00
outSound = "karateman/offbeatLightbulbOut" ;
else
outSound = "karateman/lightbulbOut" ;
2022-08-15 00:47:13 +00:00
var mobj = CreateItemInstance ( beat , "Item01" , expression , KarateManPot . ItemType . Bulb ) ;
2022-07-29 19:06:22 +00:00
mobj . GetComponent < KarateManPot > ( ) . SetBulbColor ( LightBulbColors [ 0 ] ) ;
break ;
case ( int ) HitType . Rock :
2022-08-15 00:47:13 +00:00
CreateItemInstance ( beat , "Item02" , expression , KarateManPot . ItemType . Rock ) ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitType . Ball :
2022-08-15 00:47:13 +00:00
CreateItemInstance ( beat , "Item03" , expression , KarateManPot . ItemType . Ball ) ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitType . CookingPot :
2022-08-15 00:47:13 +00:00
CreateItemInstance ( beat , "Item06" , expression , KarateManPot . ItemType . Cooking ) ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitType . Alien :
2022-08-15 00:47:13 +00:00
CreateItemInstance ( beat , "Item07" , expression , KarateManPot . ItemType . Alien ) ;
break ;
case ( int ) HitType . Bomb :
CreateItemInstance ( beat , "Item04" , expression , KarateManPot . ItemType . Bomb ) ;
2022-07-29 19:06:22 +00:00
break ;
case ( int ) HitType . TacoBell :
2022-08-15 00:47:13 +00:00
CreateItemInstance ( beat , "Item99" , expression , KarateManPot . ItemType . TacoBell ) ;
2022-07-29 19:06:22 +00:00
break ;
default :
2022-08-15 00:47:13 +00:00
CreateItemInstance ( beat , "Item00" , expression ) ;
2022-07-29 19:06:22 +00:00
break ;
2022-03-01 17:40:59 +00:00
}
2023-06-10 19:13:29 +00:00
if ( ! muteSound ) SoundByte . PlayOneShotGame ( outSound , forcePlay : true ) ;
2022-02-26 18:27:02 +00:00
}
2023-06-10 19:13:29 +00:00
public void CreateBulbSpecial ( double beat , int type , Color c , int expression )
2022-02-26 18:27:02 +00:00
{
2022-07-29 19:06:22 +00:00
string outSound ;
2023-06-10 19:13:29 +00:00
if ( beat + 0.5f % 1.0 = = 0f )
2022-07-29 19:06:22 +00:00
outSound = "karateman/offbeatLightbulbOut" ;
else
outSound = "karateman/lightbulbOut" ;
2022-08-15 00:47:13 +00:00
var mobj = CreateItemInstance ( beat , "Item01" , expression , KarateManPot . ItemType . Bulb ) ;
2021-12-30 12:17:22 +00:00
2022-07-29 19:06:22 +00:00
if ( type = = ( int ) LightBulbType . Custom )
mobj . GetComponent < KarateManPot > ( ) . SetBulbColor ( c ) ;
else
mobj . GetComponent < KarateManPot > ( ) . SetBulbColor ( LightBulbColors [ type ] ) ;
2023-06-10 19:13:29 +00:00
SoundByte . PlayOneShotGame ( outSound , forcePlay : true ) ;
2021-12-29 06:52:48 +00:00
}
2022-01-19 05:40:49 +00:00
2023-06-10 19:13:29 +00:00
public void Combo ( double beat , int expression )
2022-03-03 21:16:06 +00:00
{
2023-06-10 19:13:29 +00:00
SoundByte . PlayOneShotGame ( "karateman/barrelOutCombos" , forcePlay : true ) ;
2022-03-03 21:16:06 +00:00
2022-07-29 19:06:22 +00:00
int comboId = KarateManPot . GetNewCombo ( ) ;
BeatAction . New ( gameObject , new List < BeatAction . Action > ( )
2022-01-21 07:09:32 +00:00
{
2022-08-15 00:47:13 +00:00
new BeatAction . Action ( beat , delegate { CreateItemInstance ( beat , "Item00" , 0 , KarateManPot . ItemType . ComboPot1 , comboId ) ; } ) ,
new BeatAction . Action ( beat + 0.25f , delegate { CreateItemInstance ( beat + 0.25f , "Item00" , 0 , KarateManPot . ItemType . ComboPot2 , comboId ) ; } ) ,
new BeatAction . Action ( beat + 0.5f , delegate { CreateItemInstance ( beat + 0.5f , "Item00" , 0 , KarateManPot . ItemType . ComboPot3 , comboId ) ; } ) ,
new BeatAction . Action ( beat + 0.75f , delegate { CreateItemInstance ( beat + 0.75f , "Item00" , 0 , KarateManPot . ItemType . ComboPot4 , comboId ) ; } ) ,
new BeatAction . Action ( beat + 1f , delegate { CreateItemInstance ( beat + 1f , "Item00" , 0 , KarateManPot . ItemType . ComboPot5 , comboId ) ; } ) ,
new BeatAction . Action ( beat + 1.5f , delegate { CreateItemInstance ( beat + 1.5f , "Item05" , expression , KarateManPot . ItemType . ComboBarrel , comboId ) ; } ) ,
2022-01-21 07:09:32 +00:00
} ) ;
2022-07-29 19:06:22 +00:00
MultiSound . Play ( new MultiSound . Sound [ ]
2022-01-21 07:09:32 +00:00
{
2022-07-29 19:06:22 +00:00
new MultiSound . Sound ( "karateman/punchy1" , beat + 1f ) ,
new MultiSound . Sound ( "karateman/punchy2" , beat + 1.25f ) ,
new MultiSound . Sound ( "karateman/punchy3" , beat + 1.5f ) ,
new MultiSound . Sound ( "karateman/punchy4" , beat + 1.75f ) ,
new MultiSound . Sound ( "karateman/ko" , beat + 2f ) ,
new MultiSound . Sound ( "karateman/pow" , beat + 2.5f )
} , forcePlay : true ) ;
2022-01-19 05:40:49 +00:00
}
2022-02-27 03:28:15 +00:00
2023-06-10 19:13:29 +00:00
public void Kick ( double beat , bool ball , int expression )
2022-07-29 19:26:59 +00:00
{
2023-06-10 19:13:29 +00:00
SoundByte . PlayOneShotGame ( "karateman/barrelOutKicks" , forcePlay : true ) ;
2022-07-29 19:26:59 +00:00
2022-08-15 00:47:13 +00:00
CreateItemInstance ( beat , "Item05" , expression , KarateManPot . ItemType . KickBarrel , content : ball ) ;
2022-07-29 19:26:59 +00:00
MultiSound . Play ( new MultiSound . Sound [ ]
{
new MultiSound . Sound ( "karateman/punchKick1" , beat + 1f ) ,
new MultiSound . Sound ( "karateman/punchKick2" , beat + 1.5f ) ,
new MultiSound . Sound ( "karateman/punchKick3" , beat + 1.75f ) ,
new MultiSound . Sound ( "karateman/punchKick4" , beat + 2.5f ) ,
} , forcePlay : true ) ;
}
2023-06-10 19:13:29 +00:00
public GameObject CreateItemInstance ( double beat , string awakeAnim , int successExpression , KarateManPot . ItemType type = KarateManPot . ItemType . Pot , int comboId = - 1 , bool content = false )
2022-02-27 03:28:15 +00:00
{
2022-07-29 19:06:22 +00:00
GameObject mobj = GameObject . Instantiate ( Item , ItemHolder ) ;
KarateManPot mobjDat = mobj . GetComponent < KarateManPot > ( ) ;
mobjDat . type = type ;
mobjDat . startBeat = beat ;
mobjDat . awakeAnim = awakeAnim ;
mobjDat . comboId = comboId ;
2022-08-15 00:47:13 +00:00
mobjDat . OnHitExpression = successExpression ;
mobjDat . KickBarrelContent = content ;
2022-07-29 19:06:22 +00:00
mobj . SetActive ( true ) ;
2022-02-27 17:02:46 +00:00
2022-07-29 19:06:22 +00:00
return mobj ;
2022-02-27 03:28:15 +00:00
}
2022-08-03 22:55:13 +00:00
2023-06-10 19:13:29 +00:00
void SetBgEffectsToLast ( double beat )
2022-08-07 23:40:06 +00:00
{
2023-06-10 19:13:29 +00:00
var bgfx = GameManager . instance . Beatmap . Entities . FindAll ( en = > en . datamodel = = "karateman/set background effects" ) ;
2022-08-07 23:40:06 +00:00
for ( int i = 0 ; i < bgfx . Count ; i + + )
{
var e = bgfx [ i ] ;
if ( e . beat > beat )
break ;
2022-09-18 20:48:14 +00:00
SetBgEffectsUnloaded ( e . beat , e . length , e [ "type" ] , e [ "type2" ] , e [ "colorA" ] , e [ "colorB" ] , e [ "type3" ] , e [ "type4" ] , e [ "type5" ] , e [ "colorC" ] , e [ "colorD" ] ) ;
2022-08-07 23:40:06 +00:00
}
2023-06-10 19:13:29 +00:00
var camfx = GameManager . instance . Beatmap . Entities . FindAll ( en = > en . datamodel = = "karateman/special camera" ) ;
2022-09-18 20:48:14 +00:00
DoSpecialCamera ( 0 , 0 , true ) ;
2022-08-19 23:46:37 +00:00
for ( int i = 0 ; i < camfx . Count ; i + + )
2022-08-07 23:40:06 +00:00
{
2022-08-19 23:46:37 +00:00
var e = camfx [ i ] ;
2022-08-07 23:40:06 +00:00
if ( e . beat > beat )
break ;
2022-08-21 23:46:45 +00:00
DoSpecialCamera ( e . beat , e . length , e [ "toggle" ] ) ;
2022-08-07 23:40:06 +00:00
}
2023-06-10 19:13:29 +00:00
var objfx = GameManager . instance . Beatmap . Entities . FindAll ( en = > en . datamodel = = "karateman/set object colors" ) ;
2022-09-18 20:48:14 +00:00
for ( int i = 0 ; i < objfx . Count ; i + + )
{
var e = objfx [ i ] ;
if ( e . beat > beat )
break ;
UpdateMaterialColour ( e [ "colorA" ] , e [ "colorB" ] , e [ "colorC" ] ) ;
}
SetBgAndShadowCol ( WantBgChangeStart , WantBgChangeLength , bgType , ( int ) currentShadowType , bgColour , customShadowColour , ( int ) currentBgEffect ) ;
SetBgTexture ( textureType , textureFilterType , filterColour , filterColour ) ;
2022-08-07 23:40:06 +00:00
}
2023-06-10 19:13:29 +00:00
public static void SetBgEffectsUnloaded ( double beat , float length , int newBgType , int newShadowType , Color bgCol , Color shadowCol , int bgFx , int texture , int textureFilter , Color filterCol , Color filterColNext )
2022-08-14 21:39:42 +00:00
{
WantBgChangeStart = beat ;
WantBgChangeLength = length ;
bgType = newBgType ;
currentShadowType = newShadowType ;
bgColour = bgCol ;
customShadowColour = shadowCol ;
currentBgEffect = bgFx ;
textureType = texture ;
textureFilterType = textureFilter ;
filterColour = filterCol ;
filterColourNext = filterColNext ;
}
2023-06-10 19:13:29 +00:00
public void SetBgAndShadowCol ( double beat , float length , int newBgType , int shadowType , Color a , Color b , int fx )
2022-08-03 22:55:13 +00:00
{
2022-08-06 23:15:44 +00:00
SetBgFx ( fx , beat , length ) ;
2022-08-07 01:09:28 +00:00
UpdateShadowColour ( shadowType , b ) ;
2022-08-06 23:15:44 +00:00
2022-08-14 21:39:42 +00:00
bgType = newBgType ;
if ( bgType = = ( int ) BackgroundType . Custom )
2022-08-06 23:15:44 +00:00
bgColour = a ;
else
2022-08-14 21:39:42 +00:00
bgColour = BackgroundColors [ newBgType ] ;
2022-08-06 23:15:44 +00:00
BGPlane . color = bgColour ;
2022-08-07 01:09:28 +00:00
//😢
if ( fx ! = ( int ) BackgroundFXType . Fade )
2022-08-19 23:46:37 +00:00
{
bgColourLast = bgColour ;
2022-08-07 01:09:28 +00:00
oldShadowColour = GetShadowColor ( true ) ;
2022-08-19 23:46:37 +00:00
}
2022-08-07 01:09:28 +00:00
2022-08-14 21:39:42 +00:00
if ( textureFilterType = = ( int ) ShadowType . Tinted )
2022-08-06 23:15:44 +00:00
filterColour = Color . LerpUnclamped ( bgColour , ShadowBlendColor , 0.45f ) ;
}
2023-06-10 19:13:29 +00:00
public void SetBgFx ( int fx , double beat , float length )
2022-08-06 23:15:44 +00:00
{
switch ( fx )
2022-08-03 22:55:13 +00:00
{
2022-08-06 23:15:44 +00:00
case ( int ) BackgroundFXType . Fade :
bgColourLast = bgColour ;
bgFadeTime = beat ;
bgFadeDuration = length ;
break ;
default :
2022-08-14 21:39:42 +00:00
currentBgEffect = fx ;
2022-08-06 23:15:44 +00:00
break ;
2022-08-03 22:55:13 +00:00
}
2022-08-06 23:15:44 +00:00
}
public void SetBgTexture ( int type , int filterType , Color filterColor , Color nextColor )
{
2022-08-14 21:39:42 +00:00
textureType = type ;
textureFilterType = filterType ;
if ( textureFilterType = = ( int ) ShadowType . Tinted )
2022-08-06 23:15:44 +00:00
filterColour = Color . LerpUnclamped ( bgColour , filterColor , 0.45f ) ;
else
{
filterColour = filterColor ;
filterColourNext = nextColor ;
}
2022-08-14 21:39:42 +00:00
switch ( textureType )
2022-08-03 22:55:13 +00:00
{
2022-08-13 03:33:50 +00:00
case ( int ) BackgroundTextureType . Blood :
BGBlood . SetActive ( true ) ;
2022-08-13 22:38:22 +00:00
BGGradient . SetActive ( false ) ;
2022-08-14 20:29:39 +00:00
BGRadial . SetActive ( false ) ;
2022-08-13 03:33:50 +00:00
break ;
2022-08-06 23:15:44 +00:00
case ( int ) BackgroundTextureType . Gradient :
BGGradient . SetActive ( true ) ;
2022-08-13 22:38:22 +00:00
BGBlood . SetActive ( false ) ;
2022-08-14 20:29:39 +00:00
BGRadial . SetActive ( false ) ;
break ;
case ( int ) BackgroundTextureType . Radial :
BGRadial . SetActive ( true ) ;
BGBlood . SetActive ( false ) ;
BGGradient . SetActive ( false ) ;
2022-08-06 23:15:44 +00:00
break ;
default :
BGGradient . SetActive ( false ) ;
2022-08-13 03:33:50 +00:00
BGBlood . SetActive ( false ) ;
2022-08-14 20:29:39 +00:00
BGRadial . SetActive ( false ) ;
2022-08-06 23:15:44 +00:00
break ;
2022-08-03 22:55:13 +00:00
}
2022-08-06 23:15:44 +00:00
UpdateFilterColour ( bgColour , filterColour ) ;
}
2023-06-10 19:13:29 +00:00
public void SetGameplayMods ( double beat , int mode , bool combo )
2022-08-13 01:06:41 +00:00
{
NoriGO . SetActive ( true ) ;
2022-08-13 22:38:22 +00:00
Nori . SetNoriMode ( beat , mode ) ;
2022-08-13 01:06:41 +00:00
IsComboEnable = combo ;
}
2022-08-06 23:15:44 +00:00
void UpdateFilterColour ( Color bgColor , Color filterColor )
{
2022-09-23 02:05:04 +00:00
bgGradientRenderer = BGGradient . GetComponent < SpriteRenderer > ( ) ;
bgBloodRenderer = BGBlood . GetComponent < SpriteRenderer > ( ) ;
bgRadialRenderer = BGRadial . GetComponent < SpriteRenderer > ( ) ;
2022-08-06 23:15:44 +00:00
Color col ;
2022-08-14 21:39:42 +00:00
if ( textureFilterType = = ( int ) ShadowType . Tinted )
2022-08-06 23:15:44 +00:00
col = Color . LerpUnclamped ( bgColor , ShadowBlendColor , 0.45f ) ;
else
col = filterColor ;
2022-08-03 22:55:13 +00:00
2022-08-06 23:15:44 +00:00
bgGradientRenderer . color = col ;
2022-08-13 03:33:50 +00:00
bgBloodRenderer . color = col ;
2022-08-14 20:29:39 +00:00
bgRadialRenderer . color = col ;
2022-08-06 23:15:44 +00:00
}
public static Color ShadowBlendColor = new Color ( 195 / 255f , 48 / 255f , 2 / 255f ) ;
public Color GetShadowColor ( bool next = false )
{
Color lastCol , nextCol ;
lastCol = oldShadowColour ;
if ( currentShadowType = = ( int ) ShadowType . Custom )
2022-08-07 01:09:28 +00:00
nextCol = customShadowColour ;
2022-08-06 23:15:44 +00:00
else if ( bgType < ( int ) BackgroundType . Custom )
nextCol = ShadowColors [ bgType ] ;
else
nextCol = Color . LerpUnclamped ( bgColour , ShadowBlendColor , 0.45f ) ;
float fadeProg = Conductor . instance . GetPositionFromBeat ( bgFadeTime , bgFadeDuration ) ;
if ( fadeProg < = 1f & & fadeProg > = 0 )
{
return Color . LerpUnclamped ( lastCol , nextCol , fadeProg ) ;
}
return next ? nextCol : lastCol ;
2022-08-03 22:55:13 +00:00
}
2022-08-07 01:09:28 +00:00
public void UpdateShadowColour ( int type , Color colour )
2022-08-03 22:55:13 +00:00
{
2022-08-06 23:15:44 +00:00
if ( currentShadowType = = ( int ) ShadowType . Custom )
oldShadowColour = customShadowColour ;
else if ( bgType < ( int ) BackgroundType . Custom )
oldShadowColour = ShadowColors [ bgType ] ;
else
oldShadowColour = Color . LerpUnclamped ( bgColour , ShadowBlendColor , 0.45f ) ;
2022-08-06 01:19:18 +00:00
currentShadowType = type ;
2022-08-03 22:55:13 +00:00
customShadowColour = colour ;
}
2022-08-06 01:19:18 +00:00
2022-08-14 22:59:28 +00:00
public static void UpdateMaterialColour ( Color mainCol , Color highlightCol , Color objectCol )
2022-08-14 21:39:42 +00:00
{
BodyColor = mainCol ;
HighlightColor = highlightCol ;
ItemColor = objectCol ;
2022-08-11 23:36:47 +00:00
}
2023-06-10 19:13:29 +00:00
public void SetParticleEffect ( double beat , int type , float windStrength , float particleStrength )
2022-08-06 01:19:18 +00:00
{
2022-08-07 23:40:06 +00:00
ParticleSystem . EmissionModule emm ;
2022-08-06 01:19:18 +00:00
switch ( type )
{
case ( int ) ParticleType . Snow :
SnowEffectGO . SetActive ( true ) ;
SnowEffect . Play ( ) ;
emm = SnowEffect . emission ;
2022-08-07 23:40:06 +00:00
emm . rateOverTime = particleStrength * 6f ;
2022-08-06 01:19:18 +00:00
break ;
case ( int ) ParticleType . Fire :
FireEffectGO . SetActive ( true ) ;
FireEffect . Play ( ) ;
emm = FireEffect . emission ;
2022-08-07 23:40:06 +00:00
emm . rateOverTime = particleStrength * 6f ;
2022-08-06 01:19:18 +00:00
break ;
case ( int ) ParticleType . Rain :
RainEffectGO . SetActive ( true ) ;
RainEffect . Play ( ) ;
emm = RainEffect . emission ;
emm . rateOverTime = particleStrength * 32f ;
break ;
default :
SnowEffect . Stop ( ) ;
2022-08-06 23:15:44 +00:00
FireEffect . Stop ( ) ;
RainEffect . Stop ( ) ;
2022-08-06 01:19:18 +00:00
break ;
}
Wind . windMain = windStrength ;
}
2022-08-06 02:37:06 +00:00
2023-06-10 19:13:29 +00:00
public void ToggleBop ( double beat , float length , bool toggle , bool autoBop )
2022-08-07 23:40:06 +00:00
{
2023-03-07 19:11:43 +00:00
if ( autoBop )
2023-06-10 19:13:29 +00:00
Joe . bop . length = float . MaxValue ;
2023-03-07 19:11:43 +00:00
else
Joe . bop . length = 0 ;
2022-08-07 23:40:06 +00:00
if ( toggle )
2023-03-07 17:22:32 +00:00
{
for ( int i = 0 ; i < length ; i + + )
{
BeatAction . New ( instance . gameObject , new List < BeatAction . Action > ( )
{
new BeatAction . Action ( beat + i , delegate
{
Joe . Bop ( ) ;
} )
} ) ;
}
}
2022-08-07 23:40:06 +00:00
}
2022-08-14 21:39:42 +00:00
public static void ToggleBopUnloaded ( bool toggle )
{
WantBop = toggle ;
}
2023-06-10 19:13:29 +00:00
public void Prepare ( double beat , float length )
2022-08-07 23:40:06 +00:00
{
Joe . Prepare ( beat , length ) ;
}
2022-08-06 02:37:06 +00:00
public void SetFaceExpression ( int face )
{
Joe . SetFaceExpression ( face ) ;
}
2021-12-29 06:52:48 +00:00
}
2022-08-11 23:36:47 +00:00
}