diff --git a/Assets/Scripts/Conductor.cs b/Assets/Scripts/Conductor.cs
index ecf10bd0b..36e965e49 100644
--- a/Assets/Scripts/Conductor.cs
+++ b/Assets/Scripts/Conductor.cs
@@ -141,7 +141,9 @@ namespace HeavenStudio
public void SetBeat(double beat)
{
- var chart = GameManager.instance.Beatmap;
+ var gameManager = GameManager.instance;
+
+ var chart = gameManager.Beatmap;
double offset = chart.data.offset;
startPos = GetSongPosFromBeat(beat);
@@ -152,9 +154,13 @@ namespace HeavenStudio
SeekMusicToTime(startPos, offset);
+ var oldSongPosBeat = songPosBeat;
songPosBeat = GetBeatFromSongPos(time);
+ if (oldSongPosBeat != songPosBeat && gameManager.minigame != null) {
+ gameManager.minigame.OnTimelineChange(songPosBeat);
+ }
- GameManager.instance.SetCurrentEventToClosest(beat);
+ gameManager.SetCurrentEventToClosest(beat);
}
public void PlaySetup(double beat)
diff --git a/Assets/Scripts/Games/CheerReaders/CheerReaders.cs b/Assets/Scripts/Games/CheerReaders/CheerReaders.cs
index 79991e176..3b0b48d80 100644
--- a/Assets/Scripts/Games/CheerReaders/CheerReaders.cs
+++ b/Assets/Scripts/Games/CheerReaders/CheerReaders.cs
@@ -213,7 +213,7 @@ namespace HeavenStudio.Games
}
}
- public override void OnTimeChange()
+ public override void OnTimelineChange(double beat)
{
UpdateCameraZoom();
}
diff --git a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs
index cf383a523..6d149b154 100644
--- a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs
+++ b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs
@@ -67,10 +67,10 @@ namespace HeavenStudio.Games.Loaders
resizable = true,
parameters = new List()
{
- new Param("colorAStart", new Color(43/255f, 207/255f, 51/255f), "Color A Start", "Set the top-most color of the background gradient at the start of the event."),
- new Param("colorA", new Color(43/255f, 207/255f, 51/255f), "Color A End", "Set the top-most color of the background gradient at the end of the event."),
- new Param("colorBStart", new Color(1, 1, 1), "Color B Start", "Set the bottom-most color of the background gradient at the start of the event."),
- new Param("colorB", new Color(1, 1, 1), "Color B End", "Set the bottom-most color of the background gradient at the end of the event."),
+ new Param("colorAStart", new Color(43/255f, 207/255f, 51/255f), "Top Color Start", "Set the top-most color of the background gradient at the start of the event."),
+ new Param("colorA", new Color(43/255f, 207/255f, 51/255f), "Top Color End", "Set the top-most color of the background gradient at the end of the event."),
+ new Param("colorBStart", new Color(1, 1, 1), "Bottom Color Start", "Set the bottom-most color of the background gradient at the start of the event."),
+ new Param("colorB", new Color(1, 1, 1), "Bottom Color End", "Set the bottom-most color of the background gradient at the end of the event."),
new Param("colorC", new Color(1, 247/255f, 0), "Streak Color", "Set the color of the streaks that appear upon a successful hit."),
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.")
}
@@ -280,46 +280,22 @@ namespace HeavenStudio.Games
SetFaces(0);
}
- private double colorStartBeat = -1;
- private float colorLength = 0f;
- private Color colorStart = new Color(43 / 255f, 207 / 255f, 51 / 255f); //obviously put to the default color of the game
- private Color colorEnd = new Color(43 / 255f, 207 / 255f, 51 / 255f);
- private Color colorStartB = Color.white; //obviously put to the default color of the game
- private Color colorEndB = Color.white;
- private Util.EasingFunction.Ease colorEase; //putting Util in case this game is using jukebox
+ private ColorEase tColorEase = new(new Color(43 / 255f, 207 / 255f, 51 / 255f)); // top gradient color
+ private ColorEase bColorEase = new(Color.white); // bottom gradient color
//call this in update
private void BackgroundColorUpdate()
{
- float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
-
- var func = Util.EasingFunction.GetEasingFunction(colorEase);
-
- float newR = func(colorStart.r, colorEnd.r, normalizedBeat);
- float newG = func(colorStart.g, colorEnd.g, normalizedBeat);
- float newB = func(colorStart.b, colorEnd.b, normalizedBeat);
-
- backgroundGradient.color = new Color(newR, newG, newB);
-
- float newRB = func(colorStartB.r, colorEndB.r, normalizedBeat);
- float newGB = func(colorStartB.g, colorEndB.g, normalizedBeat);
- float newBB = func(colorStartB.b, colorEndB.b, normalizedBeat);
-
- background.color = new Color(newRB, newGB, newBB);
+ backgroundGradient.color = GetNewColor(tColorEase);
+ background.color = GetNewColor(bColorEase);
}
- public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, Color colorStartSetB, Color colorEndSetB, Color setStreak, int ease)
+ public void BackgroundColor(double beat, float length, Color colorStartSetT, Color colorEndSetT, Color colorStartSetB, Color colorEndSetB, Color setStreak, int ease)
{
- colorStartBeat = beat;
- colorLength = length;
- colorStart = colorStartSet;
- colorEnd = colorEndSet;
- colorStartB = colorStartSetB;
- colorEndB = colorEndSetB;
- colorEase = (Util.EasingFunction.Ease)ease;
+ tColorEase = new ColorEase(beat, length, colorStartSetT, colorEndSetT, ease);
+ bColorEase = new ColorEase(beat, length, colorStartSetB, colorEndSetB, ease);
- foreach (SpriteRenderer streak in streaks)
- {
+ foreach (SpriteRenderer streak in streaks) {
streak.color = new Color(setStreak.r, setStreak.g, setStreak.b, streak.color.a);
}
}
diff --git a/Assets/Scripts/Games/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs
index b7372a240..7e6ed6fc9 100644
--- a/Assets/Scripts/Games/KarateMan/KarateMan.cs
+++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs
@@ -117,7 +117,6 @@ namespace HeavenStudio.Games.Loaders
},
inactiveFunction = delegate {
var e = eventCaller.currentEntity;
- KarateMan.QueueCue(e);
KarateMan.CreateItemSFX(e.beat, e["type"], e["mute"]);
},
defaultLength = 2,
@@ -137,7 +136,6 @@ namespace HeavenStudio.Games.Loaders
},
inactiveFunction = delegate {
var e = eventCaller.currentEntity;
- KarateMan.QueueCue(e);
if (!e["mute"]) KarateMan.CreateBulbSFX(e.beat, e["type"], e["sfx"], e["throwSfx"]);
},
defaultLength = 2,
@@ -167,7 +165,6 @@ namespace HeavenStudio.Games.Loaders
},
inactiveFunction = delegate {
var e = eventCaller.currentEntity;
- KarateMan.QueueCue(e);
KarateMan.KickSFX();
},
defaultLength = 4f,
@@ -196,7 +193,6 @@ namespace HeavenStudio.Games.Loaders
},
inactiveFunction = delegate {
var e = eventCaller.currentEntity;
- KarateMan.QueueCue(e);
KarateMan.ComboSFX();
},
defaultLength = 4,
@@ -310,6 +306,7 @@ namespace HeavenStudio.Games.Loaders
new Param("startTexture", new Color(), "Start Texture Color", "Set the color at the start of the event."),
new Param("endTexture", new Color(), "End Texture Color", "Set the color at the end of the event."),
},
+ isVfx = true,
},
// new GameAction("set background effects", "Background Appearance (OLD)")
// {
@@ -526,7 +523,7 @@ namespace HeavenStudio.Games
}
#endregion
- static List queuedCues = new();
+ // static List queuedCues = new();
public static bool IsComboEnable = true; //only stops Out combo inputs, this basically makes combo contextual
// public static bool IsKickEnable = true; //same as above, except with kick inputs
public bool IsNoriActive { get { return Nori.MaxNori > 0; } }
@@ -567,16 +564,6 @@ namespace HeavenStudio.Games
static double wordClearTime = double.MinValue;
[Header("Backgrounds")]
- // // 0 = bg color, 1 = shadow color, 2 = filter color
- // private double[] colorStartBeats = new double[3] {
- // -1,
- // -1,
- // -1
- // };
- // private float[] colorLengths = new float[3];
- // private Color[] colorStarts, colorEnds = new Color[3];
- // private Util.EasingFunction.Ease[] colorEases = new Util.EasingFunction.Ease[3];
-
private ColorEase[] colorEases = new ColorEase[3];
public int currentBgEffect = (int)BackgroundFXType.None;
@@ -718,38 +705,32 @@ namespace HeavenStudio.Games
Update();
}
+ public override void OnPlay(double beat) => OnGameSwitch(beat);
public override void OnGameSwitch(double beat)
{
+ EntityPreCheck(beat);
+
+ var entities = gameManager.Beatmap.Entities.FindAll(e => (e.datamodel is "karateman/hit" or "karateman/bulb" or "karateman/kick" or "karateman/combo") && e.beat < beat && e.beat + 1 > beat);
+
// queued objects
- if (queuedCues.Count > 0)
+ foreach (var e in entities.FindAll(e => (e.datamodel is "karateman/hit" or "karateman/bulb" or "karateman/kick" or "karateman/combo") && e.beat < beat && e.beat + 1 > beat))
{
- foreach (var e in queuedCues)
- {
- 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;
- 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;
- case "karateman/combo": Combo(e.beat, e["type"], e["pitchVoice"], e["forcePitch"], e["cutOut"], e["disableVoice"]); break;
- default: Debug.LogError($"Karate Man has failed to cue an object with datamodel {e.datamodel} at beat {e.beat}"); break;
- }
+ 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;
+ 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;
+ case "karateman/combo": Combo(e.beat, e["type"], e["pitchVoice"], e["forcePitch"], e["cutOut"], e["disableVoice"]); break;
+ default: Debug.LogError($"Karate Man has failed to cue an object with datamodel {e.datamodel} at beat {e.beat}"); break;
}
- queuedCues.Clear();
}
-
- EntityPreCheck(beat);
- }
-
- public override void OnPlay(double beat)
- {
- queuedCues.Clear();
- EntityPreCheck(beat);
}
+ public override void OnStop(double beat) => EntityPreCheck(beat);
+ public override void OnTimelineChange(double beat) => EntityPreCheck(beat);
void EntityPreCheck(double beat)
{
if (gameManager == null) return;
- List prevEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split(0) == "karateman");
+ List prevEntities = gameManager.Beatmap.Entities.FindAll(c => c.datamodel.Split(0) == "karateman");
RiqEntity voice = prevEntities.FindLast(c => c.beat < beat && c.datamodel == "karateman/warnings");
if (wordClearTime > beat && wordStartTime < beat && voice != null)
@@ -802,10 +783,10 @@ namespace HeavenStudio.Games
{
var songPos = conductor.songPositionInBeatsAsDouble;
- if (conductor != null && !conductor.isPlaying)
- {
- EntityPreCheck(songPos);
- }
+ // if (conductor != null && !conductor.isPlaying)
+ // {
+ // EntityPreCheck(songPos);
+ // }
switch (currentBgEffect)
{
@@ -871,7 +852,6 @@ namespace HeavenStudio.Games
}
if (!Conductor.instance.NotStopped())
{
- if (queuedCues.Count > 0) queuedCues.Clear();
startCamSpecial = double.MinValue;
wantsReturn = double.MinValue;
cameraReturnLength = 0f;
@@ -927,11 +907,6 @@ namespace HeavenStudio.Games
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)
{
if (!muteSound) SoundByte.PlayOneShotGame($"karateman/{(beat % 1.0 == 0.5 ? $"offbeatObject" : "object")}Out", forcePlay: true);
diff --git a/Assets/Scripts/Games/Kitties/Kitties.cs b/Assets/Scripts/Games/Kitties/Kitties.cs
index 981e4822e..4a4a8cbc8 100644
--- a/Assets/Scripts/Games/Kitties/Kitties.cs
+++ b/Assets/Scripts/Games/Kitties/Kitties.cs
@@ -479,33 +479,17 @@ namespace HeavenStudio.Games
player.canClap = true;
}
- private double colorStartBeat = -1;
- private float colorLength = 0f;
- private Color colorStart = Color.white; //obviously put to the default color of the game
- private Color colorEnd = Color.white;
- private Util.EasingFunction.Ease colorEase; //putting Util in case this game is using jukebox
+ private ColorEase bgColorEase = new(Color.white);
//call this in update
private void BackgroundColorUpdate()
{
- float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
-
- var func = Util.EasingFunction.GetEasingFunction(colorEase);
-
- float newR = func(colorStart.r, colorEnd.r, normalizedBeat);
- float newG = func(colorStart.g, colorEnd.g, normalizedBeat);
- float newB = func(colorStart.b, colorEnd.b, normalizedBeat);
-
- background.color = new Color(newR, newG, newB);
+ background.color = GetNewColor(bgColorEase);
}
public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, int ease)
{
- colorStartBeat = beat;
- colorLength = length;
- colorStart = colorStartSet;
- colorEnd = colorEndSet;
- colorEase = (Util.EasingFunction.Ease)ease;
+ bgColorEase = new ColorEase(beat, length, colorStartSet, colorEndSet, ease);
}
//call this in OnPlay(double beat) and OnGameSwitch(double beat)
diff --git a/Assets/Scripts/Games/Minigame.cs b/Assets/Scripts/Games/Minigame.cs
index eed715871..748b124e7 100644
--- a/Assets/Scripts/Games/Minigame.cs
+++ b/Assets/Scripts/Games/Minigame.cs
@@ -290,7 +290,7 @@ namespace HeavenStudio.Games
{
}
- public virtual void OnTimeChange()
+ public virtual void OnTimelineChange(double beat)
{
}
@@ -429,7 +429,7 @@ namespace HeavenStudio.Games
#endregion
#region Color
- public struct ColorEase
+ public class ColorEase
{
public double startBeat;
public float length;
diff --git a/Assets/Scripts/Games/Ringside/Ringside.cs b/Assets/Scripts/Games/Ringside/Ringside.cs
index 968209b6d..b40410043 100644
--- a/Assets/Scripts/Games/Ringside/Ringside.cs
+++ b/Assets/Scripts/Games/Ringside/Ringside.cs
@@ -193,7 +193,7 @@ namespace HeavenStudio.Games
}
}
- public override void OnTimeChange()
+ public override void OnTimelineChange(double beat)
{
UpdateCameraZoom();
}
diff --git a/Assets/Scripts/Games/Spaceball/Spaceball.cs b/Assets/Scripts/Games/Spaceball/Spaceball.cs
index 027e41813..4810c91e8 100644
--- a/Assets/Scripts/Games/Spaceball/Spaceball.cs
+++ b/Assets/Scripts/Games/Spaceball/Spaceball.cs
@@ -123,7 +123,7 @@ namespace HeavenStudio.Games
Destroy(BallsHolder.transform.GetChild(i).gameObject);
}
- public override void OnTimeChange()
+ public override void OnTimelineChange(double beat)
{
UpdateCameraZoom();
}
diff --git a/Assets/Scripts/Games/TapTroupe/TapTroupe.cs b/Assets/Scripts/Games/TapTroupe/TapTroupe.cs
index 2b4efccc1..e7839f7ea 100644
--- a/Assets/Scripts/Games/TapTroupe/TapTroupe.cs
+++ b/Assets/Scripts/Games/TapTroupe/TapTroupe.cs
@@ -179,7 +179,7 @@ namespace HeavenStudio.Games
}
}
- public override void OnTimeChange()
+ public override void OnTimelineChange(double beat)
{
UpdateCameraZoom();
}
diff --git a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs
index d4f620684..63109aa22 100644
--- a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs
+++ b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs
@@ -6,6 +6,7 @@ using Jukebox;
using TMPro;
using System.Linq;
using System.Collections.Generic;
+using static HeavenStudio.Minigames;
namespace HeavenStudio.Editor.Track
{
@@ -38,6 +39,7 @@ namespace HeavenStudio.Editor.Track
[Header("Properties")]
public RiqEntity entity;
+ public GameAction gameAction;
public float length;
private bool lastVisible;
public bool selected;
@@ -97,6 +99,7 @@ namespace HeavenStudio.Editor.Track
if (action != null)
{
+ gameAction = action;
this.resizable = action.resizable;
if (action.resizable == false)
{
@@ -326,9 +329,15 @@ namespace HeavenStudio.Editor.Track
if (Conductor.instance.NotStopped()) return;
if (Input.GetMouseButton(1) || Input.GetMouseButton(2)) return;
- if (!moving)
- if (!altWhenClicked)
+ if (!moving) {
+ if (!altWhenClicked) {
altWhenClicked = Input.GetKey(KeyCode.LeftAlt);
+ }
+ } else {
+ if (gameAction.isVfx) {
+ gameAction.function.Invoke();
+ }
+ }
if (!altWhenClicked)
{
diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs
index c2f74d7db..fa83a7936 100644
--- a/Assets/Scripts/Minigames.cs
+++ b/Assets/Scripts/Minigames.cs
@@ -760,6 +760,35 @@ namespace HeavenStudio
GameManager.instance.ToggleInputs(eventCaller.currentEntity["toggle"]);
}
),
+
+ // These are still here for backwards-compatibility but are hidden in the editor
+ new GameAction("flash", "", 1f, true,
+ new List()
+ {
+ new Param("colorA", Color.white, "Start Color"),
+ new Param("colorB", Color.white, "End Color"),
+ new Param("valA", new EntityTypes.Float(0, 1, 1), "Start Opacity"),
+ new Param("valB", new EntityTypes.Float(0, 1, 0), "End Opacity"),
+ new Param("ease", Util.EasingFunction.Ease.Linear, "Ease")
+ },
+ hidden: true
+ ),
+ new GameAction("move camera", "", 1f, true, new List()
+ {
+ new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left"),
+ new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down"),
+ new Param("valC", new EntityTypes.Float(-0, 250, 10), "In / Out"),
+ new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type")
+ },
+ hidden: true ),
+ new GameAction("rotate camera", "", 1f, true, new List()
+ {
+ new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Pitch"),
+ new Param("valB", new EntityTypes.Integer(-360, 360, 0), "Yaw"),
+ new Param("valC", new EntityTypes.Integer(-360, 360, 0), "Roll"),
+ new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type")
+ },
+ hidden: true ),
}),
new Minigame("countIn", "Count-Ins", "", false, true, new List()
diff --git a/Assets/Scripts/Util/MultiSound.cs b/Assets/Scripts/Util/MultiSound.cs
index b5a40e925..21ea2fbdc 100644
--- a/Assets/Scripts/Util/MultiSound.cs
+++ b/Assets/Scripts/Util/MultiSound.cs
@@ -35,14 +35,14 @@ namespace HeavenStudio.Util
}
}
- public static MultiSound Play(Sound[] snds, bool game = true, bool forcePlay = false)
+ public static MultiSound Play(Sound[] sounds, bool game = true, bool forcePlay = false)
{
- return Play(snds.ToList(), game, forcePlay);
+ return Play(sounds.ToList(), game, forcePlay);
}
public static MultiSound Play(List sounds, bool game = true, bool forcePlay = false)
{
- if (Conductor.instance == null || sounds.Count <= 0) return null;
+ if (Conductor.instance == null || sounds.Count < 1) return null;
GameObject go = new GameObject("MultiSound");
MultiSound ms = go.AddComponent();