FINALLY got old bg blocks updating + better bulb sfx

store the keys of the objects in the dictionary that i want to remove, create the properties, then remove all of the objects using the keys.

bulbs use a method that lets any sfx go through for the throw and hit, which means custom lightbulb cues 😃

moved all queuing into one list, then a foreach checks the datamodel of each riqentity in the list

camera bug fixed (call update in awake and start)

recolorable barrels lol
This commit is contained in:
AstrlJelly 2023-10-05 22:59:53 -04:00
parent b569edb23f
commit 33cb0c3ac4
4 changed files with 171 additions and 224 deletions

View file

@ -61807,6 +61807,10 @@ MonoBehaviour:
- {fileID: 7106630173843556496} - {fileID: 7106630173843556496}
- {fileID: 5747805804250125440} - {fileID: 5747805804250125440}
- {fileID: 1280364348460651971} - {fileID: 1280364348460651971}
ItemBarrelMap:
- {r: 0.4509804, g: 0.3019608, b: 0.27058825, a: 1}
- {r: 0, g: 0, b: 0, a: 1}
- {r: 0.7137255, g: 0.30980393, b: 0.42352942, a: 1}
ItemAlienMap: ItemAlienMap:
- {r: 0.14509805, g: 0.14509805, b: 0.14509805, a: 1} - {r: 0.14509805, g: 0.14509805, b: 0.14509805, a: 1}
- {r: 0.99215686, g: 0.99607843, b: 0.99607843, a: 1} - {r: 0.99215686, g: 0.99607843, b: 0.99607843, a: 1}
@ -61815,10 +61819,6 @@ MonoBehaviour:
- {r: 1, g: 0.08235294, b: 0.12941177, a: 1} - {r: 1, g: 0.08235294, b: 0.12941177, a: 1}
- {r: 1, g: 0.9372549, b: 0.03137255, a: 1} - {r: 1, g: 0.9372549, b: 0.03137255, a: 1}
- {r: 0, g: 0, b: 0, a: 0} - {r: 0, g: 0, b: 0, a: 0}
ItemBarrelMap:
- {r: 0.4509804, g: 0.3019608, b: 0.27058825, a: 1}
- {r: 0.3019608, g: 0.16862746, b: 0.03529412, a: 1}
- {r: 0.7137255, g: 0.30980393, b: 0.42352942, a: 1}
ItemCookingLidMap: ItemCookingLidMap:
- {r: 0, g: 0, b: 0, a: 1} - {r: 0, g: 0, b: 0, a: 1}
- {r: 1, g: 1, b: 1, a: 0} - {r: 1, g: 1, b: 1, a: 0}
@ -97175,6 +97175,9 @@ MonoBehaviour:
NoriGO: {fileID: 4562470404778909465} NoriGO: {fileID: 4562470404778909465}
Nori: {fileID: 3856490809560069226} Nori: {fileID: 3856490809560069226}
MappingMaterial: {fileID: 2100000, guid: 01a12550d4a6d8141bbbdf4ce2700eea, type: 2} MappingMaterial: {fileID: 2100000, guid: 01a12550d4a6d8141bbbdf4ce2700eea, type: 2}
BodyColor: {r: 1, g: 1, b: 1, a: 1}
HighlightColor: {r: 0.81, g: 0.81, b: 0.81, a: 1}
ItemColor: {r: 1, g: 1, b: 1, a: 1}
Word: {fileID: 8471847813194768760} Word: {fileID: 8471847813194768760}
currentBgEffect: 0 currentBgEffect: 0
BGPlane: {fileID: 5423016352081307686} BGPlane: {fileID: 5423016352081307686}

View file

@ -18,12 +18,10 @@ namespace HeavenStudio.Games.Loaders
{ {
if (datamodel == "karateman/hitX") if (datamodel == "karateman/hitX")
{ {
if (e["type"] == null) return null;
int newWarning = (int)e["type"]; int newWarning = (int)e["type"];
if (e["type"] < 7) { newWarning = (e["type"] < 7) ? newWarning + 1 : 0;
newWarning++;
} else {
newWarning = 0;
}
e.CreateProperty("whichWarning", newWarning); e.CreateProperty("whichWarning", newWarning);
e.CreateProperty("pitchVoice", false); e.CreateProperty("pitchVoice", false);
@ -40,42 +38,36 @@ namespace HeavenStudio.Games.Loaders
} }
RiqBeatmap.OnUpdateEntity += WarningUpdater; RiqBeatmap.OnUpdateEntity += WarningUpdater;
// RiqEntity BackgroundUpdater(string datamodel, RiqEntity e) RiqEntity BackgroundUpdater(string datamodel, RiqEntity e)
// { {
// if (datamodel == "karateman/set background effects") if (e.datamodel == "karateman/set background effects")
// { {
// Debug.Log(e["colorA"]); var toRemove = e.dynamicData.Keys.Where(x => x != "track").ToList();
// void NewProperty(string newProp, string remove) {
// var v = e[remove];
// if (v.GetType() == typeof(Newtonsoft.Json.Linq.JObject)) {
// v = new Color((float)v["r"], (float)v["g"], (float)v["b"]);
// }
// e.CreateProperty(newProp, v);
// e.dynamicData.Remove(remove);
// }
// bool fade = e["type3"] == 3; bool fade = e["type3"] == 3;
e.CreateProperty("presetBg", (int)e["type"]);
e.CreateProperty("startColor", e["colorA"]);
e.CreateProperty("shadowType", (int)e["type2"]);
e.CreateProperty("shadowStart", e["colorB"]);
e.CreateProperty("shadowEnd", e["colorB"]);
e.CreateProperty("textureType", (int)e["type4"]);
e.CreateProperty("autoColor", e["type5"] == (int)KarateMan.ShadowType.Tinted);
e.CreateProperty("startTexture", e["colorC"]);
e.CreateProperty("endTexture", e["colorC"]);
e.CreateProperty("endColor", fade ? e["colorD"] : e["colorA"]);
e.CreateProperty("ease", fade ? (int)Util.EasingFunction.Ease.Linear : (int)Util.EasingFunction.Ease.Instant);
// NewProperty("presetBg", "type"); foreach (var remove in toRemove) {
// NewProperty("startColor", "colorA"); e.dynamicData.Remove(remove);
// NewProperty("endColor", fade ? "colorD" : "colorA"); }
// NewProperty("shadowType", "type2");
// NewProperty("shadowStart", "colorB");
// NewProperty("shadowEnd", "colorB");
// NewProperty("textureType", "type4");
// NewProperty("autoColor", "type5");
// e.CreateProperty("startTexture", e["colorC"]);
// NewProperty("endTexture", "colorC");
// e.CreateProperty("ease", fade ? (int)Util.EasingFunction.Ease.Linear : null); e.datamodel = "karateman/background appearance";
// e.dynamicData.Remove("type3");
// e.datamodel = "background appearance"; return e;
// return e; }
// } return null;
// return null; }
// } RiqBeatmap.OnUpdateEntity += BackgroundUpdater;
// RiqBeatmap.OnUpdateEntity += BackgroundUpdater;
// RiqEntity GameCapitalizer(string datamodel, RiqEntity entity) // RiqEntity GameCapitalizer(string datamodel, RiqEntity entity)
@ -123,7 +115,7 @@ namespace HeavenStudio.Games.Loaders
}, },
inactiveFunction = delegate { inactiveFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
KarateMan.QueueItem(e.beat, e["type"], e["type2"]); KarateMan.QueueCue(e);
KarateMan.CreateItemSFX(e.beat, e["type"], e["mute"]); KarateMan.CreateItemSFX(e.beat, e["type"], e["mute"]);
}, },
defaultLength = 2, defaultLength = 2,
@ -138,13 +130,13 @@ namespace HeavenStudio.Games.Loaders
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
KarateMan.instance.CreateBulbSpecial(e.beat, e["ntrSfx"] ? 4 : e["type"], e["colorA"], e["type2"]); KarateMan.instance.CreateBulbSpecial(e.beat, e["type"], e["colorA"], e["type2"], e["sfx"], e["hitSfx"]);
if (!e["mute"]) KarateMan.CreateBulbSFX(e.beat, e["type"], e["ntrSfx"]); if (!e["mute"]) KarateMan.CreateBulbSFX(e.beat, e["type"], e["sfx"], e["throwSfx"]);
}, },
inactiveFunction = delegate { inactiveFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
KarateMan.QueueBulb(e.beat, e["ntrSfx"] ? 4 : e["type"], e["colorA"], e["type2"]); KarateMan.QueueCue(e);
if (!e["mute"]) KarateMan.CreateBulbSFX(e.beat, e["type"], e["ntrSfx"]); if (!e["mute"]) KarateMan.CreateBulbSFX(e.beat, e["type"], e["sfx"], e["throwSfx"]);
}, },
defaultLength = 2, defaultLength = 2,
parameters = new List<Param>() parameters = new List<Param>()
@ -156,19 +148,24 @@ namespace HeavenStudio.Games.Loaders
new Param("colorA", new Color(1f,1f,1f), "Custom Color", "The color to use when the bulb type is set to Custom"), 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"), 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?"), new Param("mute", false, "Mute", "Should the throwing sound be muted?"),
new Param("ntrSfx", false, "DS SFX", "Use DS's lightbulb sfx?"), new Param("sfx", KarateMan.LightBulbSfx.Automatic, "SFX", "What type of SFX to use for the bulb?", new List<Param.CollapseParam>()
{
new Param.CollapseParam(x => (int)x == (int)KarateMan.LightBulbSfx.Custom, new string[] { "throwSfx", "hitSfx" }),
}),
new Param("throwSfx", "lightbulbOut", "Throw SFX", "Custom throw SFX to use for the bulb"),
new Param("hitSfx", "lightbulbHit", "Hit SFX", "Custom hit SFX to use for the bulb"),
}, },
}, },
new GameAction("kick", "Special: Kick") new GameAction("kick", "Special: Kick")
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
KarateMan.instance.Kick(e.beat, e["toggle"], e["shouldGlow"], e["type"], e["pitchVoice"], e["forcePitch"], e["cutOut"], e["disableVoice"]); KarateMan.instance.Kick(e.beat, e["toggle"], e["shouldGlow"], e["type"], e["pitchVoice"], e["forcePitch"], e["cutOut"], e["disableVoice"], e["woodColor"], e["hoopColor"]);
KarateMan.KickSFX(); KarateMan.KickSFX();
}, },
inactiveFunction = delegate { inactiveFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
KarateMan.QueueKick(e.beat, e["toggle"], e["shouldGlow"], e["type"], e["pitchVoice"], e["forcePitch"], e["cutOut"], e["disableVoice"]); KarateMan.QueueCue(e);
KarateMan.KickSFX(); KarateMan.KickSFX();
}, },
defaultLength = 4f, defaultLength = 4f,
@ -184,6 +181,8 @@ namespace HeavenStudio.Games.Loaders
new Param("forcePitch", new EntityTypes.Float(0.5f, 2f, 1f), "Force Pitch", "Override the automatic pitching if not set to 1"), new Param("forcePitch", new EntityTypes.Float(0.5f, 2f, 1f), "Force Pitch", "Override the automatic pitching if not set to 1"),
new Param("cutOut", true, "Cut Out Voice", "Will this cue be cut out by another voice?"), new Param("cutOut", true, "Cut Out Voice", "Will this cue be cut out by another voice?"),
new Param("disableVoice", false, "Disable Voice", "When enabled, there will be no voice during this cue"), new Param("disableVoice", false, "Disable Voice", "When enabled, there will be no voice during this cue"),
new Param("woodColor", new Color(0.451f, 0.302f, 0.271f), "Barrel Wood Color", "Color of the barrel's wood"),
new Param("hoopColor", new Color(0.714f, 0.309f, 0.424f), "Barrel Hoop Color", "Color of the barrel's hoops"),
} }
}, },
new GameAction("combo", "Special: Combo") new GameAction("combo", "Special: Combo")
@ -195,7 +194,7 @@ namespace HeavenStudio.Games.Loaders
}, },
inactiveFunction = delegate { inactiveFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
KarateMan.QueueCombo(e.beat, e["type"], e["pitchVoice"], e["forcePitch"], e["cutOut"], e["disableVoice"]); KarateMan.QueueCue(e);
KarateMan.ComboSFX(); KarateMan.ComboSFX();
}, },
defaultLength = 4, defaultLength = 4,
@ -337,7 +336,7 @@ namespace HeavenStudio.Games.Loaders
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
KarateMan.UpdateMaterialColour(e["colorA"], e["colorB"], e["colorC"]); KarateMan.instance.UpdateMaterialColour(e["colorA"], e["colorB"], e["colorC"]);
}, },
defaultLength = 0.5f, defaultLength = 0.5f,
parameters = new List<Param>() parameters = new List<Param>()
@ -376,11 +375,27 @@ namespace HeavenStudio.Games.Loaders
// blah blah blah compatibility // blah blah blah compatibility
new GameAction("hitX", "Old Warning (you shouldn't see this.)") new GameAction("hitX", "Old Warning (you shouldn't see this.)")
{ {
parameters = new List<Param>(){
new Param("whichWarning", KarateMan.HitThree.HitThree, "Which Warning", "The warning text to show and the sfx to play"),
},
hidden = true, hidden = true,
} parameters = new List<Param>(){
new Param("type", KarateMan.HitThree.HitThree, "Which Warning", "The warning text to show and the sfx to play"),
},
},
new GameAction("set background effects", "Background Appearance (OLD)")
{
hidden = true,
parameters = new List<Param>()
{
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"),
},
},
}, },
new List<string>() {"agb", "ntr", "rvl", "ctr", "pco", "normal"}, new List<string>() {"agb", "ntr", "rvl", "ctr", "pco", "normal"},
"karate", "en", "karate", "en",
@ -395,31 +410,6 @@ namespace HeavenStudio.Games
using Scripts_KarateMan; using Scripts_KarateMan;
public class KarateMan : Minigame public class KarateMan : Minigame
{ {
#region Queued Objects
static List<QueuedObject> queuedObjects = new();
static List<QueuedObject> queuedBulbs = new();
struct QueuedObject
{
public double beat;
public int type;
public int expression;
public Color color;
}
static List<QueuedSpecial> queuedKicks = new();
static List<QueuedSpecial> queuedCombos = new();
struct QueuedSpecial
{
public double beat;
public int expression;
public bool pitchVoice;
public float forcePitch;
public bool cutOut;
public bool noVoice;
public bool ball;
public bool glow;
}
#endregion
#region Enums #region Enums
public enum HitType public enum HitType
@ -454,6 +444,14 @@ namespace HeavenStudio.Games
Custom Custom
} }
public enum LightBulbSfx
{
Automatic,
Megamix,
DS,
Custom
}
public enum BackgroundType public enum BackgroundType
{ {
Yellow, Yellow,
@ -522,6 +520,7 @@ namespace HeavenStudio.Games
} }
#endregion #endregion
static List<RiqEntity> queuedCues = new();
public static bool IsComboEnable = true; //only stops Out combo inputs, this basically makes combo contextual public static bool IsComboEnable = true; //only stops Out combo inputs, this basically makes combo contextual
public bool IsNoriActive { get { return Nori.MaxNori > 0; } } public bool IsNoriActive { get { return Nori.MaxNori > 0; } }
public float NoriPerformance { get { if (IsNoriActive) return Nori.Nori / Nori.MaxNori; else return 1f; } } public float NoriPerformance { get { if (IsNoriActive) return Nori.Nori / Nori.MaxNori; else return 1f; } }
@ -533,7 +532,7 @@ namespace HeavenStudio.Games
[Header("Camera Positions")] [Header("Camera Positions")]
public Transform[] CameraPosition; public Transform[] CameraPosition;
Vector3 cameraPosition; Vector3 cameraPosition;
// for future astrl : make these not static (use a RiqEntity check on game switch) // for future astrl : maybe make these not static? (use a RiqEntity check on game switch)
static double startCamSpecial = double.MinValue; static double startCamSpecial = double.MinValue;
static double wantsReturn = double.MinValue; static double wantsReturn = double.MinValue;
static float cameraReturnLength = 0f; static float cameraReturnLength = 0f;
@ -549,9 +548,9 @@ namespace HeavenStudio.Games
[Header("Colour Map")] [Header("Colour Map")]
public Material MappingMaterial; public Material MappingMaterial;
public static Color BodyColor = Color.white; public Color BodyColor = Color.white;
public static Color HighlightColor = new Color(0.81f, 0.81f, 0.81f); public Color HighlightColor = new Color(0.81f, 0.81f, 0.81f);
public static Color ItemColor = Color.white; public Color ItemColor = Color.white;
[Header("Word")] [Header("Word")]
public Animator Word; public Animator Word;
@ -565,8 +564,7 @@ namespace HeavenStudio.Games
-1 -1
}; };
private float[] colorLengths = new float[3]; private float[] colorLengths = new float[3];
private Color[] colorStarts = new Color[3]; private Color[] colorStarts, colorEnds = new Color[3];
private Color[] colorEnds = new Color[3];
private Util.EasingFunction.Ease[] colorEases = new Util.EasingFunction.Ease[3]; private Util.EasingFunction.Ease[] colorEases = new Util.EasingFunction.Ease[3];
public int currentBgEffect = (int)BackgroundFXType.None; public int currentBgEffect = (int)BackgroundFXType.None;
@ -576,13 +574,6 @@ namespace HeavenStudio.Games
public SpriteRenderer[] BGTextures; public SpriteRenderer[] BGTextures;
// public GameObject BGGradient;
// SpriteRenderer bgGradientRenderer;
// public GameObject BGRadial;
// SpriteRenderer bgRadialRenderer;
// public GameObject BGBlood;
// SpriteRenderer bgBloodRenderer;
Animator bgEffectAnimator; Animator bgEffectAnimator;
SpriteRenderer bgEffectSpriteRenderer; SpriteRenderer bgEffectSpriteRenderer;
@ -592,16 +583,18 @@ namespace HeavenStudio.Games
public ParticleSystem[] Effects; public ParticleSystem[] Effects;
[Header("Unloaded Game Calls")] [Header("Unloaded Game Calls")]
public List<RiqEntity> voiceEntities = new(); public List<RiqEntity> voiceEntities, hitVoiceEntities = new();
public List<RiqEntity> hitVoiceEntities = new();
public static KarateMan instance; public static KarateMan instance;
private void Awake() private void Awake()
{ {
instance = this; instance = this;
KarateManPot.ResetLastCombo(); KarateManPot.ResetLastCombo();
cameraPosition = CameraPosition[0].position;
bgEffectAnimator = BGEffect.GetComponent<Animator>();
bgEffectSpriteRenderer = BGEffect.GetComponent<SpriteRenderer>();
colorEnds = colorEnds =
colorStarts = new Color[] { colorStarts = new Color[] {
@ -610,47 +603,41 @@ namespace HeavenStudio.Games
new(), new(),
}; };
if (!Conductor.instance.isPlaying) { Update();
OnGameSwitch(Conductor.instance.songPositionInBeatsAsDouble);
}
GameCamera.additionalPosition = cameraPosition - GameCamera.defaultPosition;
} }
private void Start() => Update();
public override void OnStop(double beat) => OnGameSwitch(beat);
public override void OnPlay(double beat) => OnGameSwitch(beat);
public override void OnGameSwitch(double beat) public override void OnGameSwitch(double beat)
{ {
// queued objects // queued objects
if (queuedObjects.Count > 0) { if (queuedCues.Count > 0) {
foreach (var qObj in queuedObjects) { CreateItem(qObj.beat, qObj.type, qObj.expression); } foreach (var e in queuedCues) {
queuedObjects.Clear(); switch (e.datamodel) {
} case "karateman/hit" : CreateItem(e.beat, e["type"], e["type2"]); break;
case "karateman/bulb" : CreateBulbSpecial(e.beat, e["type"], e["colorA"], e["type2"], e["sfx"], e["hitSfx"]); break;
if (queuedBulbs.Count > 0) { case "karateman/kick" : Kick(e.beat, e["toggle"], e["shouldGlow"], e["type"], e["pitchVoice"], e["forcePitch"], e["cutOut"], e["disableVoice"], e["woodColor"], e["hoopColor"]); break;
foreach (var qObj in queuedBulbs) { CreateBulbSpecial(qObj.beat, qObj.type, qObj.color, qObj.expression); } case "karateman/combo": Combo(e.beat, e["type"], e["pitchVoice"], e["forcePitch"], e["cutOut"], e["disableVoice"]); break;
queuedBulbs.Clear(); default : Debug.LogError($"Karate Man has failed to cue an object with datamodel {e.datamodel} at beat {e.beat}"); break;
} }
}
if (queuedKicks.Count > 0) { queuedCues.Clear();
foreach (var qObj in queuedKicks) { Kick(qObj.beat, qObj.ball, qObj.glow, qObj.expression, qObj.pitchVoice, qObj.forcePitch, qObj.cutOut, qObj.noVoice); }
queuedKicks.Clear();
}
if (queuedCombos.Count > 0) {
foreach (var qObj in queuedCombos) { Combo(qObj.beat, qObj.expression, qObj.pitchVoice, qObj.forcePitch, qObj.cutOut, qObj.noVoice); }
queuedCombos.Clear();
} }
List<RiqEntity> prevEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split(0) == "karateman"); List<RiqEntity> prevEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split(0) == "karateman");
RiqEntity voice = prevEntities.FindLast(c => c.beat < beat && c.datamodel.Split(1) == "warnings"); RiqEntity voice = prevEntities.FindLast(c => c.beat < beat && c.datamodel == "karateman/warnings");
if (wordClearTime > beat && voice != null) { if (wordClearTime > beat && voice != null) {
var type = voice["whichWarning"]; var type = voice["whichWarning"];
Word.Play($"Word0{(type < (int)HitThree.HitThreeAlt ? type : type - 1)}"); Word.Play($"Word0{(type < (int)HitThree.HitThreeAlt ? type : type - 1)}");
} }
// init colors // init colors
RiqEntity bg = prevEntities.FindLast(c => c.beat <= beat && c.datamodel.Split(1) == "background appearance"); RiqEntity bg = prevEntities.FindLast(c => c.beat <= beat && c.datamodel == "karateman/background appearance");
RiqEntity obj = prevEntities.FindLast(c => c.beat <= beat && c.datamodel.Split(1) == "set object colors"); RiqEntity obj = prevEntities.FindLast(c => c.beat <= beat && c.datamodel == "karateman/set object colors");
if (bg != null) { if (bg != null) {
BackgroundColor( BackgroundColor(
@ -671,36 +658,23 @@ namespace HeavenStudio.Games
} }
// init modifier(s) // init modifier(s)
RiqEntity bop = prevEntities.FindLast(c => c.beat < beat && c.datamodel.Split(1) == "bop"); RiqEntity bop = prevEntities.FindLast(c => c.beat < beat && c.datamodel == "karateman/bop");
if (bop != null) ToggleBop(0, 0, false, bop["toggle"]); ToggleBop(0, 0, false, bop?["toggle"] ?? true);
else ToggleBop(0, 0, false, true);
// get all entities to later check against eachother to cut out voices // get all entities to later check against eachother to cut out voices
voiceEntities = prevEntities.FindAll(c => c.beat > beat && (c.datamodel.Split(1) is "kick" or "combo")); voiceEntities = prevEntities.FindAll(c => c.beat > beat && (c.datamodel is "karateman/kick" or "karateman/combo"));
hitVoiceEntities = prevEntities.FindAll(c => c.beat > beat && (c.datamodel.Split(1) is "warnings" && c["whichWarning"] <= (int)HitThree.HitFour)); hitVoiceEntities = prevEntities.FindAll(c => c.beat > beat && (c.datamodel is "karateman/warnings" && c["whichWarning"] <= (int)HitThree.HitFour));
} }
public override void OnStop(double beat)
{
OnGameSwitch(beat);
}
public override void OnPlay(double beat)
{
OnGameSwitch(beat);
}
private void Start()
{
GameCamera.additionalPosition = cameraPosition - GameCamera.defaultPosition;
bgEffectAnimator = BGEffect.GetComponent<Animator>();
bgEffectSpriteRenderer = BGEffect.GetComponent<SpriteRenderer>();
}
private void Update() private void Update()
{ {
var cond = Conductor.instance; var cond = Conductor.instance;
if (!cond.isPlaying) {
OnGameSwitch(cond.songPositionInBeatsAsDouble);
}
switch (currentBgEffect) switch (currentBgEffect)
{ {
case (int) BackgroundFXType.Sunburst: case (int) BackgroundFXType.Sunburst:
@ -752,18 +726,17 @@ namespace HeavenStudio.Games
} }
BackgroundColorUpdate(); BackgroundColorUpdate();
GameCamera.additionalPosition = cameraPosition - GameCamera.defaultPosition; GameCamera.additionalPosition = cameraPosition - GameCamera.defaultPosition;
BGEffect.transform.position = new Vector3(GameCamera.instance.transform.position.x, GameCamera.instance.transform.position.y, 0); BGEffect.transform.position = new Vector3(GameCamera.instance.transform.position.x, GameCamera.instance.transform.position.y, 0);
Debug.Log("GameCamera.additionalPosition : " + GameCamera.additionalPosition);
Debug.Log("cameraPosition : " + cameraPosition);
} }
private void OnDestroy() private void OnDestroy()
{ {
if (!Conductor.instance.NotStopped()) { if (!Conductor.instance.NotStopped()) {
if (queuedObjects.Count > 0) queuedObjects.Clear(); if (queuedCues.Count > 0) queuedCues.Clear();
if (queuedBulbs.Count > 0) queuedBulbs.Clear();
if (queuedKicks.Count > 0) queuedKicks.Clear();
if (queuedCombos.Count > 0) queuedCombos.Clear();
startCamSpecial = double.MinValue; startCamSpecial = double.MinValue;
wantsReturn = double.MinValue; wantsReturn = double.MinValue;
cameraReturnLength = 0f; cameraReturnLength = 0f;
@ -811,9 +784,7 @@ namespace HeavenStudio.Games
new MultiSound.Sound($"karateman/{number}", beat + 1f), new MultiSound.Sound($"karateman/{number}", beat + 1f),
}; };
if (pitchVoice) { if (pitchVoice) {
foreach (var sound in sounds) { Array.ForEach(sounds, x => x.pitch = (forcePitch == 1) ? Conductor.instance.GetBpmAtBeat(x.beat) / 125 : forcePitch);
sound.pitch = (forcePitch == 1) ? Conductor.instance.GetBpmAtBeat(sound.beat) / 125 : forcePitch;
}
} }
MultiSound.Play(sounds, forcePlay: true); MultiSound.Play(sounds, forcePlay: true);
} }
@ -825,24 +796,28 @@ namespace HeavenStudio.Games
return $"Word0{(type < (int)HitThree.HitThreeAlt ? type : type - 1)}"; return $"Word0{(type < (int)HitThree.HitThreeAlt ? type : type - 1)}";
} }
public static void QueueCue(RiqEntity entity)
{
queuedCues.Add(entity);
}
public static void CreateItemSFX(double beat, int type, bool muteSound = false) public static void CreateItemSFX(double beat, int type, bool muteSound = false)
{ {
if (!muteSound) SoundByte.PlayOneShotGame($"karateman/{(beat % 1.0 == 0.5 ? $"offbeatObject" : "object")}Out", forcePlay: true); if (!muteSound) SoundByte.PlayOneShotGame($"karateman/{(beat % 1.0 == 0.5 ? $"offbeatObject" : "object")}Out", forcePlay: true);
} }
public static void CreateBulbSFX(double beat, int type, bool ntrSfx = false) public static void CreateBulbSFX(double beat, int type, int sfx, string throwSfx)
{ {
string obj = type == (int)LightBulbType.Yellow || ntrSfx ? "LightbulbNtr" : "Lightbulb"; string obj = sfx switch {
SoundByte.PlayOneShotGame($"karateman/{(beat % 1.0 == 0.5 ? $"offbeat{obj}" : obj.ToLower())}Out", forcePlay: true); (int)LightBulbSfx.Automatic => type == (int)LightBulbType.Yellow ? "LightbulbNtr" : "Lightbulb",
} (int)LightBulbSfx.DS => "LightbulbNtr",
(int)LightBulbSfx.Custom => throwSfx,
public static void QueueItem(double beat, int type, int expression) _ => "Lightbulb",
{ };
queuedObjects.Add(new QueuedObject() { if (sfx != (int)LightBulbSfx.Custom) {
beat = beat, obj = (beat % 1.0 == 0.5) ? $"offbeat{obj}Out" : obj.ToLower() + "Out";
type = type, }
expression = expression, SoundByte.PlayOneShotGame($"karateman/{obj}", forcePlay: true);
});
} }
public void CreateItem(double beat, int type, int expression) public void CreateItem(double beat, int type, int expression)
@ -854,7 +829,7 @@ namespace HeavenStudio.Games
break; break;
case (int) HitType.Lightbulb: case (int) HitType.Lightbulb:
var mobj = CreateItemInstance(beat, "Item01", expression, KarateManPot.ItemType.Bulb); var mobj = CreateItemInstance(beat, "Item01", expression, KarateManPot.ItemType.Bulb);
mobj.GetComponent<KarateManPot>().SetBulbColor(LightBulbColors[0]); mobj.SetBulbColor(LightBulbColors[0]);
break; break;
case (int) HitType.Rock: case (int) HitType.Rock:
CreateItemInstance(beat, "Item02", expression, KarateManPot.ItemType.Rock); CreateItemInstance(beat, "Item02", expression, KarateManPot.ItemType.Rock);
@ -880,20 +855,16 @@ namespace HeavenStudio.Games
} }
} }
public static void QueueBulb(double beat, int type, Color color, int expression) public void CreateBulbSpecial(double beat, int type, Color color, int expression, int sfx, string hitSfx = "")
{ {
queuedBulbs.Add(new QueuedObject() { string obj = sfx switch {
beat = beat, (int)LightBulbSfx.Automatic => type == (int)LightBulbType.Yellow ? "LightbulbNtr" : "Lightbulb",
type = type, (int)LightBulbSfx.DS => "LightbulbNtr",
color = color, (int)LightBulbSfx.Custom => hitSfx,
expression = expression, _ => "Lightbulb",
}); };
} if (sfx != (int)LightBulbSfx.Custom) obj += "Hit";
var mobj = CreateItemInstance(beat, "Item01", expression, KarateManPot.ItemType.Bulb, hitSfxOverride: $"karateman/{obj}");
public void CreateBulbSpecial(double beat, int type, Color color, int expression)
{
string obj = (type is (int)LightBulbType.Yellow or 4) ? "LightbulbNtr" : "Lightbulb";
var mobj = CreateItemInstance(beat, "Item01", expression, KarateManPot.ItemType.Bulb, hitSfxOverride: $"karateman/{obj}Hit").GetComponent<KarateManPot>();
mobj.SetBulbColor((type == (int)LightBulbType.Custom) ? color : LightBulbColors[type]); mobj.SetBulbColor((type == (int)LightBulbType.Custom) ? color : LightBulbColors[type]);
} }
@ -903,18 +874,6 @@ namespace HeavenStudio.Games
SoundByte.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true); SoundByte.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true);
} }
public static void QueueCombo(double beat, int expression, bool pitchVoice, float forcePitch, bool cutOut, bool noVoice)
{
queuedCombos.Add(new QueuedSpecial() {
beat = beat,
expression = expression,
pitchVoice = pitchVoice,
forcePitch = forcePitch,
cutOut = cutOut,
noVoice = noVoice
});
}
public void Combo(double beat, int expression, bool pitchVoice, float forcePitch, bool cutOut, bool noVoice) public void Combo(double beat, int expression, bool pitchVoice, float forcePitch, bool cutOut, bool noVoice)
{ {
int comboId = KarateManPot.GetNewCombo(); int comboId = KarateManPot.GetNewCombo();
@ -941,9 +900,7 @@ namespace HeavenStudio.Games
}; };
if (pitchVoice) { if (pitchVoice) {
foreach (var sound in sounds) { sounds.ForEach(x => x.pitch = (forcePitch == 1) ? Conductor.instance.GetBpmAtBeat(x.beat) / 125 : forcePitch);
sound.pitch = (forcePitch == 1) ? Conductor.instance.GetBpmAtBeat(sound.beat) / 125 : forcePitch;
}
} }
if (voiceEntities.Count > 0 && cutOut) if (voiceEntities.Count > 0 && cutOut)
@ -962,23 +919,14 @@ namespace HeavenStudio.Games
SoundByte.PlayOneShotGame("karateman/barrelOutKicks", forcePlay: true); SoundByte.PlayOneShotGame("karateman/barrelOutKicks", forcePlay: true);
} }
public static void QueueKick(double beat, bool ball, bool glow, int expression, bool pitchVoice, float forcePitch, bool cutOut, bool noVoice) public void Kick(double beat, bool ball, bool glow, int expression, bool pitchVoice, float forcePitch, bool cutOut, bool noVoice, Color woodColor, Color hoopColor)
{ {
queuedKicks.Add(new QueuedSpecial() { var barrel = CreateItemInstance(beat, "Item05", expression, KarateManPot.ItemType.KickBarrel, content: ball, shouldGlow: glow);
beat = beat, // red : new Color(0.451f, 0.302f, 0.271f)
expression = expression, // green : new Color(0.302f, 0.169f, 0.035f) - unused?
pitchVoice = pitchVoice, // blue : new Color(0.714f, 0.31f, 0.424f)
forcePitch = forcePitch, barrel.ItemBarrelMap[0] = woodColor;
cutOut = cutOut, barrel.ItemBarrelMap[2] = hoopColor;
noVoice = noVoice,
ball = ball,
glow = glow,
});
}
public void Kick(double beat, bool ball, bool glow, int expression, bool pitchVoice, float forcePitch, bool cutOut, bool noVoice)
{
CreateItemInstance(beat, "Item05", expression, KarateManPot.ItemType.KickBarrel, content: ball, shouldGlow: glow);
if (noVoice) return; if (noVoice) return;
@ -990,9 +938,7 @@ namespace HeavenStudio.Games
}; };
if (pitchVoice) { if (pitchVoice) {
foreach (var sound in sounds) { sounds.ForEach(x => x.pitch = (forcePitch == 1) ? Conductor.instance.GetBpmAtBeat(x.beat) / 125 : forcePitch);
sound.pitch = (forcePitch == 1) ? Conductor.instance.GetBpmAtBeat(sound.beat) / 125 : forcePitch;
}
} }
if (voiceEntities.Count > 0 && cutOut) if (voiceEntities.Count > 0 && cutOut)
@ -1006,7 +952,7 @@ namespace HeavenStudio.Games
MultiSound.Play(sounds.ToArray(), forcePlay: true); MultiSound.Play(sounds.ToArray(), forcePlay: true);
} }
public GameObject CreateItemInstance(double beat, string awakeAnim, int successExpression, KarateManPot.ItemType type = KarateManPot.ItemType.Pot, int comboId = -1, bool content = false, bool shouldGlow = false, string hitSfxOverride = null) public KarateManPot CreateItemInstance(double beat, string awakeAnim, int successExpression, KarateManPot.ItemType type = KarateManPot.ItemType.Pot, int comboId = -1, bool content = false, bool shouldGlow = false, string hitSfxOverride = null)
{ {
GameObject mobj = Instantiate(Item, ItemHolder); GameObject mobj = Instantiate(Item, ItemHolder);
KarateManPot mobjDat = mobj.GetComponent<KarateManPot>(); KarateManPot mobjDat = mobj.GetComponent<KarateManPot>();
@ -1021,12 +967,12 @@ namespace HeavenStudio.Games
mobj.SetActive(true); mobj.SetActive(true);
return mobj; return mobjDat;
} }
public void BackgroundColor(double beat, float length, int presetBG, Color colorStart, Color colorEnd, int colorEaseSet, int shadowType, Color shadowStart, Color shadowEnd, int textureType, bool autoColor, Color filterStart, Color filterEnd) public void BackgroundColor(double beat, float length, int presetBG, Color colorStart, Color colorEnd, int colorEaseSet, int shadowType, Color shadowStart, Color shadowEnd, int textureType, bool autoColor, Color filterStart, Color filterEnd)
{ {
for (int i = 0; i < colorStarts.Length; i++){ for (int i = 0; i < colorStarts.Length; i++) {
colorStartBeats[i] = beat; colorStartBeats[i] = beat;
colorLengths[i] = length; colorLengths[i] = length;
colorEases[i] = (Util.EasingFunction.Ease)colorEaseSet; colorEases[i] = (Util.EasingFunction.Ease)colorEaseSet;
@ -1089,7 +1035,7 @@ namespace HeavenStudio.Games
} }
public static void UpdateMaterialColour(Color mainCol, Color highlightCol, Color objectCol) public void UpdateMaterialColour(Color mainCol, Color highlightCol, Color objectCol)
{ {
BodyColor = mainCol; BodyColor = mainCol;
HighlightColor = highlightCol; HighlightColor = highlightCol;

View file

@ -332,8 +332,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
public void UpdateJoeColour() public void UpdateJoeColour()
{ {
Color mainCol = KarateMan.BodyColor; Color mainCol = KarateMan.instance.BodyColor;
Color highlightCol = KarateMan.HighlightColor; Color highlightCol = KarateMan.instance.HighlightColor;
if (bombGlowIntensity > 0) if (bombGlowIntensity > 0)
{ {

View file

@ -30,9 +30,9 @@ namespace HeavenStudio.Games.Scripts_KarateMan
[SerializeField] SpriteRenderer[] cellRenderers; [SerializeField] SpriteRenderer[] cellRenderers;
Material[] cellMaterials; Material[] cellMaterials;
public Color[] ItemBarrelMap;
[SerializeField] Color[] ItemAlienMap; [SerializeField] Color[] ItemAlienMap;
[SerializeField] Color[] ItemBombMap; [SerializeField] Color[] ItemBombMap;
[SerializeField] Color[] ItemBarrelMap;
[SerializeField] Color[] ItemCookingLidMap; [SerializeField] Color[] ItemCookingLidMap;
public bool KickBarrelContent = false; public bool KickBarrelContent = false;
@ -131,13 +131,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
case ItemType.Alien: case ItemType.Alien:
alpha = ItemAlienMap[0]; alpha = ItemAlienMap[0];
bravo = ItemAlienMap[1]; bravo = ItemAlienMap[1];
delta = KarateMan.ItemColor; delta = KarateMan.instance.ItemColor;
break; break;
case ItemType.Bomb: case ItemType.Bomb:
case ItemType.KickBomb: case ItemType.KickBomb:
alpha = ItemBombMap[0]; alpha = ItemBombMap[0];
bravo = ItemBombMap[1]; bravo = ItemBombMap[1];
delta = KarateMan.ItemColor; delta = KarateMan.instance.ItemColor;
break; break;
case ItemType.KickBarrel: case ItemType.KickBarrel:
case ItemType.ComboBarrel: case ItemType.ComboBarrel:
@ -149,12 +149,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
case ItemType.CookingLid: case ItemType.CookingLid:
alpha = ItemCookingLidMap[0]; alpha = ItemCookingLidMap[0];
bravo = ItemCookingLidMap[1]; bravo = ItemCookingLidMap[1];
delta = KarateMan.ItemColor; delta = KarateMan.instance.ItemColor;
break; break;
default: default:
alpha = KarateMan.ItemColor; alpha = bravo = delta = KarateMan.instance.ItemColor;
bravo = KarateMan.ItemColor;
delta = KarateMan.ItemColor;
break; break;
} }
for (int i = 0; i < cellRenderers.Length; i++) { for (int i = 0; i < cellRenderers.Length; i++) {