2022-06-10 16:50:39 +00:00
|
|
|
using HeavenStudio.Util;
|
2023-02-17 01:14:53 +00:00
|
|
|
using HeavenStudio.Common;
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
using Starpelly.Transformer;
|
2022-06-10 16:50:39 +00:00
|
|
|
using System;
|
2023-02-17 01:14:53 +00:00
|
|
|
using System.Linq;
|
|
|
|
using System.Collections;
|
2022-06-10 16:50:39 +00:00
|
|
|
using System.Collections.Generic;
|
2023-02-17 01:14:53 +00:00
|
|
|
using System.Diagnostics;
|
2022-06-10 16:50:39 +00:00
|
|
|
using UnityEngine;
|
2023-02-17 01:14:53 +00:00
|
|
|
using UnityEngine.Rendering;
|
|
|
|
using static HeavenStudio.EntityTypes;
|
2023-06-10 19:13:29 +00:00
|
|
|
using Jukebox;
|
2022-06-10 16:50:39 +00:00
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
|
|
{
|
|
|
|
using static Minigames;
|
|
|
|
public static class RvlRocketLoader
|
|
|
|
{
|
2023-02-17 01:14:53 +00:00
|
|
|
public static Minigame AddGame(EventCaller eventCaller)
|
|
|
|
{
|
2023-04-02 02:28:23 +00:00
|
|
|
return new Minigame("launchParty", "Launch Party", "000000", false, false, new List<GameAction>()
|
2022-06-10 16:50:39 +00:00
|
|
|
{
|
2023-02-17 01:14:53 +00:00
|
|
|
new GameAction("rocket", "Family Model")
|
|
|
|
{
|
2023-02-17 16:21:34 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; LaunchParty.LaunchRocket(e.beat, e["offset"], e["note1"], e["note2"], e["note3"], e["note4"]); },
|
2023-02-17 01:14:53 +00:00
|
|
|
defaultLength = 4f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("offset", new EntityTypes.Float(-1, 2, -1), "Spawn Offset", "When should the rocket rise up?"),
|
|
|
|
new Param("note1", new EntityTypes.Integer(-24, 24, 2), "1st Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note2", new EntityTypes.Integer(-24, 24, 4), "2nd Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note3", new EntityTypes.Integer(-24, 24, 5), "3rd Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note4", new EntityTypes.Integer(-24, 24, 7), "4th Note", "The number of semitones up or down this note should be pitched")
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new GameAction("partyCracker", "Party-Popper")
|
|
|
|
{
|
2023-02-17 16:21:34 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; LaunchParty.LaunchPartyCracker(e.beat, e["offset"], e["note1"], e["note2"], e["note3"], e["note4"], e["note5"], e["note6"]); },
|
2023-02-17 01:14:53 +00:00
|
|
|
defaultLength = 3f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("offset", new EntityTypes.Float(-1, 1, -1), "Spawn Offset", "When should the rocket rise up?"),
|
|
|
|
new Param("note1", new EntityTypes.Integer(-24, 24, 4), "1st Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note2", new EntityTypes.Integer(-24, 24, 5), "2nd Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note3", new EntityTypes.Integer(-24, 24, 7), "3rd Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note4", new EntityTypes.Integer(-24, 24, 9), "4th Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note5", new EntityTypes.Integer(-24, 24, 11), "5th Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note6", new EntityTypes.Integer(-24, 24, 12), "6th Note", "The number of semitones up or down this note should be pitched")
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new GameAction("bell", "Bell")
|
|
|
|
{
|
2023-02-17 16:21:34 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; LaunchParty.LaunchBell(e.beat, e["offset"], e["note1"], e["note2"], e["note3"], e["note4"], e["note5"], e["note6"], e["note7"], e["note8"],
|
2023-02-17 01:14:53 +00:00
|
|
|
e["note9"]); },
|
|
|
|
defaultLength = 3f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("offset", new EntityTypes.Float(-1, 1, -1), "Spawn Offset", "When should the rocket rise up?"),
|
|
|
|
new Param("note1", new EntityTypes.Integer(-24, 24, 0), "1st Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note2", new EntityTypes.Integer(-24, 24, 2), "2nd Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note3", new EntityTypes.Integer(-24, 24, 4), "3rd Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note4", new EntityTypes.Integer(-24, 24, 5), "4th Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note5", new EntityTypes.Integer(-24, 24, 7), "5th Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note6", new EntityTypes.Integer(-24, 24, 9), "6th Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note7", new EntityTypes.Integer(-24, 24, 11), "7th Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note8", new EntityTypes.Integer(-24, 24, 12), "8th Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note9", new EntityTypes.Integer(-24, 24, 0), "9th Note (Launch)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new GameAction("bowlingPin", "Bowling Pin")
|
|
|
|
{
|
2023-02-17 16:21:34 +00:00
|
|
|
preFunction = delegate { var e = eventCaller.currentEntity; LaunchParty.LaunchBowlingPin(e.beat, e["offset"], e["note1"], e["note2"], e["note3"], e["note4"], e["note5"], e["note6"], e["note7"],
|
2023-02-17 01:14:53 +00:00
|
|
|
e["note8"], e["note9"], e["note10"], e["note11"], e["note12"], e["note13"], e["note14"], e["note15"]); },
|
|
|
|
defaultLength = 3f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("offset", new EntityTypes.Float(-1, 1, -1), "Spawn Offset", "When should the rocket rise up?"),
|
|
|
|
new Param("note1", new EntityTypes.Integer(-24, 24, 5), "1st Note", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note2", new EntityTypes.Integer(-24, 24, -1), "2nd Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note3", new EntityTypes.Integer(-24, 24, 0), "3rd Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note4", new EntityTypes.Integer(-24, 24, -1), "4th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note5", new EntityTypes.Integer(-24, 24, 0), "5th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note6", new EntityTypes.Integer(-24, 24, -1), "6th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note7", new EntityTypes.Integer(-24, 24, 0), "7th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note8", new EntityTypes.Integer(-24, 24, -1), "8th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note9", new EntityTypes.Integer(-24, 24, 0), "9th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note10", new EntityTypes.Integer(-24, 24, -1), "10th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note11", new EntityTypes.Integer(-24, 24, 0), "11th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note12", new EntityTypes.Integer(-24, 24, -1), "12th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note13", new EntityTypes.Integer(-24, 24, 0), "13th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note14", new EntityTypes.Integer(-24, 24, 7), "14th Note (Flute)", "The number of semitones up or down this note should be pitched"),
|
|
|
|
new Param("note15", new EntityTypes.Integer(-24, 24, 7), "15th Note", "The number of semitones up or down this note should be pitched")
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new GameAction("posMove", "Change Launch Pad Position")
|
|
|
|
{
|
|
|
|
defaultLength = 4f,
|
|
|
|
resizable = true,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("xPos", new EntityTypes.Float(-40f, 40f, 0f), "X Position", "Which position on the X axis should the Launch Pad travel to?"),
|
|
|
|
new Param("yPos", new EntityTypes.Float(-30f, 30f, 0f), "Y Position", "Which position on the Y axis should the Launch Pad travel to?"),
|
|
|
|
new Param("zPos", new EntityTypes.Float(-90f, 90f, 0f), "Z Position", "Which position on the Z axis should the Launch Pad travel to?"),
|
2023-06-10 19:13:29 +00:00
|
|
|
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?")
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
new GameAction("rotMove", "Change Launch Pad Rotation")
|
|
|
|
{
|
|
|
|
defaultLength = 4f,
|
|
|
|
resizable = true,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("rot", new EntityTypes.Float(-360, 360, 0), "Angle", "Which angle of rotation should the Launch Pad rotate towards?"),
|
2023-06-10 19:13:29 +00:00
|
|
|
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Which ease should the Launch Pad use?")
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
new GameAction("toggleStars", "Toggle Falling Stars")
|
|
|
|
{
|
|
|
|
function = delegate {var e = eventCaller.currentEntity; LaunchParty.instance.CreateParticles(e.beat, e["toggle"], e["valA"], e["valB"], e["valC"]);},
|
|
|
|
defaultLength = 0.5f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
2023-09-08 14:27:07 +00:00
|
|
|
new Param("toggle", true, "Stars Enabled", "Starfall Or No?", new List<Param.CollapseParam>()
|
|
|
|
{
|
2023-10-27 20:19:11 +00:00
|
|
|
new Param.CollapseParam((x, _) => (bool)x, new string[] { "valA", "valB", "valC"})
|
2023-09-08 14:27:07 +00:00
|
|
|
}),
|
2023-02-17 01:14:53 +00:00
|
|
|
new Param("valA", new EntityTypes.Float(0.1f, 10f, 1f), "Star Density", "How many stars are on the screen"),
|
|
|
|
new Param("valB", new EntityTypes.Float(0.01f, 5f, 0.1f), "Front Star Fall Speed", "How fast the front stars fall to the edge of the screen"),
|
|
|
|
new Param("valC", new EntityTypes.Float(0.01f, 5f, 0.1f), "Back Star Fall Speed", "How fast the stars fall to the edge of the screen")
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new GameAction("scrollSpeed", "Change Scroll Speed")
|
|
|
|
{
|
|
|
|
function = delegate {var e = eventCaller.currentEntity; LaunchParty.instance.UpdateScrollSpeed(e["speed"]); },
|
|
|
|
defaultLength = 0.5f,
|
|
|
|
parameters = new List<Param>()
|
|
|
|
{
|
|
|
|
new Param("speed", new EntityTypes.Float(0, 100, 0.5f), "Scroll Speed", "How fast will the background scroll down?"),
|
|
|
|
}
|
|
|
|
}
|
2023-05-28 17:34:44 +00:00
|
|
|
},
|
|
|
|
new List<string>() {"rvl", "normal"},
|
|
|
|
"rvlrocket", "en",
|
|
|
|
new List<string>() {}
|
|
|
|
);
|
2022-06-10 16:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games
|
|
|
|
{
|
2023-02-17 01:14:53 +00:00
|
|
|
using Scripts_LaunchParty;
|
2022-06-10 16:50:39 +00:00
|
|
|
public class LaunchParty : Minigame
|
|
|
|
{
|
2023-02-17 01:14:53 +00:00
|
|
|
[Header("Rockets")]
|
|
|
|
[SerializeField] GameObject rocket;
|
|
|
|
[SerializeField] GameObject partyCracker;
|
|
|
|
[SerializeField] GameObject bell;
|
|
|
|
[SerializeField] GameObject bowlingPin;
|
|
|
|
|
|
|
|
[Header("Components")]
|
|
|
|
[SerializeField] ParticleSystem fallingStars;
|
|
|
|
[SerializeField] ParticleSystem fallingStarsBack;
|
|
|
|
[SerializeField] Transform launchPad;
|
2023-02-27 20:13:10 +00:00
|
|
|
[SerializeField] Transform launchPadRotatable;
|
2023-02-17 01:14:53 +00:00
|
|
|
[SerializeField] Transform spawnPad;
|
|
|
|
[SerializeField] Scroll scrollScript;
|
|
|
|
[SerializeField] Animator lensFlareAnim;
|
|
|
|
public Animator launchPadSpriteAnim;
|
|
|
|
|
|
|
|
[Header("Variables")]
|
|
|
|
private float currentRotBeat;
|
|
|
|
private float currentPosBeat;
|
|
|
|
private float currentRotLength;
|
|
|
|
private float currentPosLength;
|
|
|
|
private Vector3 lastPadPos = new Vector3(0, -2.4f, 0);
|
|
|
|
private Vector3 currentPadPos = new Vector3(0, -2.4f, 0);
|
|
|
|
private float lastPadRotation;
|
|
|
|
private float currentPadRotation;
|
2023-06-10 19:13:29 +00:00
|
|
|
private Util.EasingFunction.Ease lastPosEase;
|
|
|
|
private Util.EasingFunction.Ease lastRotEase;
|
2023-02-17 16:21:34 +00:00
|
|
|
public enum RocketType
|
|
|
|
{
|
|
|
|
Family = 0,
|
|
|
|
Cracker = 1,
|
|
|
|
Bell = 2,
|
|
|
|
BowlingPin = 3
|
|
|
|
}
|
|
|
|
public struct QueuedRocket
|
|
|
|
{
|
|
|
|
public RocketType type;
|
2023-06-10 19:13:29 +00:00
|
|
|
public double beat;
|
2023-02-17 16:21:34 +00:00
|
|
|
public float offSet;
|
2023-03-27 03:09:55 +00:00
|
|
|
public List<int> notes;
|
2023-02-17 16:21:34 +00:00
|
|
|
}
|
|
|
|
private static List<QueuedRocket> queuedRockets = new List<QueuedRocket>();
|
2023-02-17 01:14:53 +00:00
|
|
|
|
|
|
|
private int currentPosIndex;
|
|
|
|
|
|
|
|
private int currentRotIndex;
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
private List<RiqEntity> allPosEvents = new List<RiqEntity>();
|
2023-02-17 01:14:53 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
private List<RiqEntity> allRotEvents = new List<RiqEntity>();
|
2023-02-17 01:14:53 +00:00
|
|
|
|
|
|
|
public static LaunchParty instance;
|
|
|
|
|
2023-02-17 16:21:34 +00:00
|
|
|
void OnDestroy()
|
|
|
|
{
|
|
|
|
if (queuedRockets.Count > 0) queuedRockets.Clear();
|
2023-06-03 23:30:17 +00:00
|
|
|
foreach (var evt in scheduledInputs)
|
|
|
|
{
|
|
|
|
evt.Disable();
|
|
|
|
}
|
2023-02-17 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-06-10 16:50:39 +00:00
|
|
|
void Awake()
|
|
|
|
{
|
2023-02-17 01:14:53 +00:00
|
|
|
instance = this;
|
|
|
|
lensFlareAnim.Play("Flashing", 0, 0);
|
|
|
|
var posEvents = EventCaller.GetAllInGameManagerList("launchParty", new string[] { "posMove" });
|
2023-06-10 19:13:29 +00:00
|
|
|
List<RiqEntity> tempPosEvents = new List<RiqEntity>();
|
2023-02-17 01:14:53 +00:00
|
|
|
for (int i = 0; i < posEvents.Count; i++)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
if (posEvents[i].beat + posEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
|
|
|
tempPosEvents.Add(posEvents[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
allPosEvents = tempPosEvents;
|
|
|
|
|
|
|
|
var rotEvents = EventCaller.GetAllInGameManagerList("launchParty", new string[] { "rotMove" });
|
2023-06-10 19:13:29 +00:00
|
|
|
List<RiqEntity> tempRotEvents = new List<RiqEntity>();
|
2023-02-17 01:14:53 +00:00
|
|
|
for (int i = 0; i < rotEvents.Count; i++)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
if (rotEvents[i].beat + rotEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
|
|
|
tempRotEvents.Add(rotEvents[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
allRotEvents = tempRotEvents;
|
|
|
|
|
|
|
|
UpdateLaunchPadPos();
|
|
|
|
UpdateLaunchPadRot();
|
2022-06-10 16:50:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
{
|
2023-02-17 01:14:53 +00:00
|
|
|
var cond = Conductor.instance;
|
2023-02-17 16:21:34 +00:00
|
|
|
if (cond.isPlaying && !cond.isPaused)
|
|
|
|
{
|
|
|
|
if (queuedRockets.Count > 0)
|
|
|
|
{
|
|
|
|
foreach (var rocket in queuedRockets)
|
|
|
|
{
|
|
|
|
SpawnRocket(rocket.beat, rocket.offSet, rocket.type, rocket.notes);
|
|
|
|
}
|
|
|
|
queuedRockets.Clear();
|
|
|
|
}
|
|
|
|
}
|
2023-02-17 01:14:53 +00:00
|
|
|
if (allPosEvents.Count > 0)
|
|
|
|
{
|
|
|
|
if (currentPosIndex < allPosEvents.Count && currentPosIndex >= 0)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
if (cond.songPositionInBeatsAsDouble >= allPosEvents[currentPosIndex].beat)
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
|
|
|
UpdateLaunchPadPos();
|
|
|
|
currentPosIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float normalizedBeat = cond.GetPositionFromBeat(currentPosBeat, currentPosLength);
|
|
|
|
|
|
|
|
if (normalizedBeat >= 0)
|
|
|
|
{
|
|
|
|
if (normalizedBeat > 1)
|
|
|
|
{
|
|
|
|
launchPad.position = currentPadPos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (currentPosLength < 0)
|
|
|
|
{
|
|
|
|
launchPad.position = currentPadPos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastPosEase);
|
2023-02-17 01:14:53 +00:00
|
|
|
|
|
|
|
float newPosX = func(lastPadPos.x, currentPadPos.x, normalizedBeat);
|
|
|
|
float newPosY = func(lastPadPos.y, currentPadPos.y, normalizedBeat);
|
|
|
|
float newPosZ = func(lastPadPos.z, currentPadPos.z, normalizedBeat);
|
|
|
|
launchPad.position = new Vector3(newPosX, newPosY, newPosZ);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (allRotEvents.Count > 0)
|
|
|
|
{
|
|
|
|
if (currentRotIndex < allRotEvents.Count && currentRotIndex >= 0)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
if (cond.songPositionInBeatsAsDouble >= allRotEvents[currentRotIndex].beat)
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
|
|
|
UpdateLaunchPadRot();
|
|
|
|
currentRotIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float normalizedBeat = cond.GetPositionFromBeat(currentRotBeat, currentRotLength);
|
|
|
|
|
|
|
|
if (normalizedBeat >= 0)
|
|
|
|
{
|
|
|
|
if (normalizedBeat > 1)
|
|
|
|
{
|
2023-02-27 20:13:10 +00:00
|
|
|
launchPadRotatable.rotation = Quaternion.Euler(0, 0, currentPadRotation);
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (currentRotLength < 0)
|
|
|
|
{
|
2023-02-27 20:13:10 +00:00
|
|
|
launchPadRotatable.rotation = Quaternion.Euler(0, 0, currentPadRotation);
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastRotEase);
|
2023-02-17 01:14:53 +00:00
|
|
|
|
|
|
|
float newRotZ = func(lastPadRotation, currentPadRotation, normalizedBeat);
|
2023-02-27 20:13:10 +00:00
|
|
|
launchPadRotatable.rotation = Quaternion.Euler(0, 0, newRotZ);
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UpdateScrollSpeed(float speed)
|
|
|
|
{
|
|
|
|
scrollScript.scrollSpeedY = speed * -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateLaunchPadPos()
|
|
|
|
{
|
|
|
|
if (currentPosIndex < allPosEvents.Count && currentPosIndex >= 0)
|
|
|
|
{
|
|
|
|
lastPadPos = launchPad.position;
|
2023-06-10 19:13:29 +00:00
|
|
|
currentPosBeat = (float)allPosEvents[currentPosIndex].beat;
|
2023-02-17 01:14:53 +00:00
|
|
|
currentPosLength = allPosEvents[currentPosIndex].length;
|
|
|
|
currentPadPos = new Vector3(allPosEvents[currentPosIndex]["xPos"], allPosEvents[currentPosIndex]["yPos"], allPosEvents[currentPosIndex]["zPos"]);
|
2023-06-10 19:13:29 +00:00
|
|
|
lastPosEase = (Util.EasingFunction.Ease)allPosEvents[currentPosIndex]["ease"];
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UpdateLaunchPadRot()
|
|
|
|
{
|
|
|
|
if (currentRotIndex < allRotEvents.Count && currentRotIndex >= 0)
|
|
|
|
{
|
2023-02-27 20:13:10 +00:00
|
|
|
lastPadRotation = launchPadRotatable.rotation.eulerAngles.z;
|
2023-06-10 19:13:29 +00:00
|
|
|
currentRotBeat = (float)allRotEvents[currentRotIndex].beat;
|
2023-02-17 01:14:53 +00:00
|
|
|
currentRotLength = allRotEvents[currentRotIndex].length;
|
|
|
|
currentPadRotation = allRotEvents[currentRotIndex]["rot"];
|
2023-06-10 19:13:29 +00:00
|
|
|
lastRotEase = (Util.EasingFunction.Ease)allRotEvents[currentRotIndex]["ease"];
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void SpawnRocket(double beat, float beatOffset, RocketType type, List<int> notes)
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
2023-02-17 16:21:34 +00:00
|
|
|
GameObject rocketToSpawn = rocket;
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case RocketType.Family:
|
|
|
|
rocketToSpawn = rocket;
|
|
|
|
break;
|
|
|
|
case RocketType.Cracker:
|
|
|
|
rocketToSpawn = partyCracker;
|
|
|
|
break;
|
|
|
|
case RocketType.Bell:
|
|
|
|
rocketToSpawn = bell;
|
|
|
|
break;
|
|
|
|
case RocketType.BowlingPin:
|
|
|
|
rocketToSpawn = bowlingPin;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GameObject spawnedRocket = Instantiate(rocketToSpawn, spawnPad, false);
|
2023-02-17 01:14:53 +00:00
|
|
|
var rocketScript = spawnedRocket.GetComponent<LaunchPartyRocket>();
|
2023-03-27 03:09:55 +00:00
|
|
|
List<float> pitchedNotes = new List<float>();
|
|
|
|
foreach (var note in notes)
|
|
|
|
{
|
2023-06-10 19:13:29 +00:00
|
|
|
pitchedNotes.Add(SoundByte.GetPitchFromSemiTones(note, true));
|
2023-03-27 03:09:55 +00:00
|
|
|
}
|
|
|
|
rocketScript.pitches.AddRange(pitchedNotes);
|
2023-02-17 16:21:34 +00:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case RocketType.Family:
|
|
|
|
rocketScript.InitFamilyRocket(beat);
|
|
|
|
break;
|
|
|
|
case RocketType.Cracker:
|
|
|
|
rocketScript.InitPartyCracker(beat);
|
|
|
|
break;
|
|
|
|
case RocketType.Bell:
|
|
|
|
rocketScript.InitBell(beat);
|
|
|
|
break;
|
|
|
|
case RocketType.BowlingPin:
|
|
|
|
rocketScript.InitBowlingPin(beat);
|
|
|
|
break;
|
|
|
|
}
|
2023-09-11 22:28:04 +00:00
|
|
|
BeatAction.New(instance, new List<BeatAction.Action>()
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
|
|
|
new BeatAction.Action(beat + beatOffset, delegate { rocketScript.Rise(); })
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public static void LaunchRocket(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour)
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
2023-03-27 03:09:55 +00:00
|
|
|
List<int> pitches = new List<int>()
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
2023-03-27 03:09:55 +00:00
|
|
|
noteOne,
|
|
|
|
noteTwo,
|
|
|
|
noteThree,
|
|
|
|
noteFour
|
2023-02-17 16:21:34 +00:00
|
|
|
};
|
|
|
|
if (GameManager.instance.currentGame == "launchParty")
|
|
|
|
{
|
|
|
|
LaunchParty.instance.SpawnRocket(beat, beatOffset, RocketType.Family, pitches);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
queuedRockets.Add(new QueuedRocket { beat = beat, offSet = beatOffset, notes = pitches, type = RocketType.Family});
|
|
|
|
}
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public static void LaunchPartyCracker(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix)
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
2023-03-27 03:09:55 +00:00
|
|
|
List<int> pitches = new List<int>()
|
2023-02-17 16:21:34 +00:00
|
|
|
{
|
2023-03-27 03:09:55 +00:00
|
|
|
noteOne,
|
|
|
|
noteTwo,
|
|
|
|
noteThree,
|
|
|
|
noteFour,
|
|
|
|
noteFive,
|
|
|
|
noteSix,
|
2023-02-17 16:21:34 +00:00
|
|
|
};
|
|
|
|
if (GameManager.instance.currentGame == "launchParty")
|
|
|
|
{
|
|
|
|
LaunchParty.instance.SpawnRocket(beat, beatOffset, RocketType.Cracker, pitches);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
queuedRockets.Add(new QueuedRocket { beat = beat, offSet = beatOffset, notes = pitches, type = RocketType.Cracker });
|
|
|
|
}
|
|
|
|
}
|
2023-02-17 01:14:53 +00:00
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public static void LaunchBell(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven, int noteEight, int noteNine)
|
2023-02-17 16:21:34 +00:00
|
|
|
{
|
2023-03-27 03:09:55 +00:00
|
|
|
List<int> pitches = new List<int>()
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
2023-03-27 03:09:55 +00:00
|
|
|
noteOne,
|
|
|
|
noteTwo,
|
|
|
|
noteThree,
|
|
|
|
noteFour,
|
|
|
|
noteFive,
|
|
|
|
noteSix,
|
|
|
|
noteSeven,
|
|
|
|
noteEight,
|
|
|
|
noteNine
|
2023-02-17 16:21:34 +00:00
|
|
|
};
|
|
|
|
if (GameManager.instance.currentGame == "launchParty")
|
|
|
|
{
|
|
|
|
LaunchParty.instance.SpawnRocket(beat, beatOffset, RocketType.Bell, pitches);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
queuedRockets.Add(new QueuedRocket { beat = beat, offSet = beatOffset, notes = pitches, type = RocketType.Bell });
|
|
|
|
}
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public static void LaunchBowlingPin(double beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven,
|
2023-02-17 01:14:53 +00:00
|
|
|
int noteEight, int noteNine, int noteTen, int noteEleven, int noteTwelve, int noteThirteen, int noteFourteen, int noteFifteen)
|
|
|
|
{
|
2023-03-27 03:09:55 +00:00
|
|
|
List<int> pitches = new List<int>()
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
2023-03-27 03:09:55 +00:00
|
|
|
noteOne,
|
|
|
|
noteTwo,
|
|
|
|
noteThree,
|
|
|
|
noteFour,
|
|
|
|
noteFive,
|
|
|
|
noteSix,
|
|
|
|
noteSeven,
|
|
|
|
noteEight,
|
|
|
|
noteNine,
|
|
|
|
noteTen,
|
|
|
|
noteEleven,
|
|
|
|
noteTwelve,
|
|
|
|
noteThirteen,
|
|
|
|
noteFourteen,
|
|
|
|
noteFifteen
|
2023-02-17 16:21:34 +00:00
|
|
|
};
|
|
|
|
if (GameManager.instance.currentGame == "launchParty")
|
|
|
|
{
|
|
|
|
LaunchParty.instance.SpawnRocket(beat, beatOffset, RocketType.BowlingPin, pitches);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
queuedRockets.Add(new QueuedRocket { beat = beat, offSet = beatOffset, notes = pitches, type = RocketType.BowlingPin });
|
|
|
|
}
|
2023-02-17 01:14:53 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void CreateParticles(double beat, bool toggle, float starDensity, float starSpeed, float starSpeedBack)
|
2023-02-17 01:14:53 +00:00
|
|
|
{
|
|
|
|
ParticleSystem.EmissionModule emm;
|
|
|
|
ParticleSystem.EmissionModule emm2;
|
|
|
|
switch (toggle)
|
|
|
|
{
|
|
|
|
case true:
|
|
|
|
var emmrate = fallingStars.velocityOverLifetime;
|
|
|
|
var emmrate2 = fallingStarsBack.velocityOverLifetime;
|
|
|
|
emmrate.speedModifier = starSpeed;
|
|
|
|
emmrate2.speedModifier = starSpeedBack;
|
|
|
|
emm = fallingStars.emission;
|
|
|
|
emm2 = fallingStarsBack.emission;
|
|
|
|
emm.rateOverTime = starDensity * 6f;
|
|
|
|
emm2.rateOverTime = starDensity * 6f;
|
|
|
|
fallingStars.Play();
|
|
|
|
fallingStarsBack.Play();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
fallingStars.Stop();
|
|
|
|
fallingStarsBack.Stop();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2022-06-10 16:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-17 01:14:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|