Tunnel Defuckedificaition + small tweaks and additions (#309)

* tweaks and fixes

* SMALL FIX
This commit is contained in:
Rapandrasmus 2023-02-21 22:56:01 +01:00 committed by GitHub
parent 1454715f97
commit 8409cb2818
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 106 additions and 72 deletions

View file

@ -1964,7 +1964,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -10
m_SortingOrder: -11
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
m_Color: {r: 0, g: 0, b: 0, a: 0.8156863}
m_FlipX: 0

View file

@ -11,36 +11,39 @@ namespace HeavenStudio.Games.Loaders
public static class AgbFireworkLoader
{
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("fireworks", "Fireworks", "0058CE", false, false, new List<GameAction>()
return new Minigame("fireworks", "Fireworks \n<color=#adadad>(Hanabi)</color>", "0058CE", false, false, new List<GameAction>()
{
new GameAction("firework", "Firework")
{
preFunction = delegate {var e = eventCaller.currentEntity; Fireworks.PreSpawnFirework(e.beat, false, e["whereToSpawn"], e["toggle"], e["explosionType"]); },
preFunction = delegate {var e = eventCaller.currentEntity; Fireworks.PreSpawnFirework(e.beat, false, e["whereToSpawn"], e["toggle"], e["explosionType"], e["applause"]); },
defaultLength = 4f,
parameters = new List<Param>()
{
new Param("whereToSpawn", Fireworks.WhereToSpawn.Middle, "Where to spawn?", "Where should the firework spawn?"),
new Param("explosionType", Fireworks.ExplosionType.MixedCircular, "Explosion Pattern", "What pattern should the firework explode with?"),
new Param("applause", false, "Applause", "Should an applause play after successfully hitting this cue?"),
new Param("toggle", false, "Practice Count-In", "Should the count-in from the fireworks practice play?")
}
},
new GameAction("sparkler", "Sparkler")
{
preFunction = delegate {var e = eventCaller.currentEntity; Fireworks.PreSpawnFirework(e.beat, true, e["whereToSpawn"], e["toggle"], e["explosionType"]); },
preFunction = delegate {var e = eventCaller.currentEntity; Fireworks.PreSpawnFirework(e.beat, true, e["whereToSpawn"], e["toggle"], e["explosionType"], e["applause"]); },
defaultLength = 2f,
parameters = new List<Param>()
{
new Param("whereToSpawn", Fireworks.WhereToSpawn.Middle, "Where to spawn?", "Where should the firework spawn?"),
new Param("explosionType", Fireworks.ExplosionType.MixedCircular, "Explosion Pattern", "What pattern should the firework explode with?"),
new Param("applause", false, "Applause", "Should an applause play after successfully hitting this cue?"),
new Param("toggle", false, "Practice Count-In", "Should the count-in from the fireworks practice play?")
}
},
new GameAction("bomb", "Bomb")
{
function = delegate {var e = eventCaller.currentEntity; Fireworks.instance.SpawnBomb(e.beat, e["toggle"]); },
function = delegate {var e = eventCaller.currentEntity; Fireworks.instance.SpawnBomb(e.beat, e["toggle"], e["applause"]); },
defaultLength = 3f,
parameters = new List<Param>()
{
new Param("applause", false, "Applause", "Should an applause play after successfully hitting this cue?"),
new Param("toggle", false, "Practice Count-In", "Should the count-in from the fireworks practice play?")
}
},
@ -87,6 +90,7 @@ namespace HeavenStudio.Games
public int whereToSpawn;
public bool practice;
public int explosionType;
public bool applause;
}
public enum WhereToSpawn
{
@ -138,7 +142,7 @@ namespace HeavenStudio.Games
{
foreach (var firework in queuedFireworks)
{
SpawnFirework(firework.beat, firework.isSparkler, firework.whereToSpawn, firework.practice, firework.explosionType);
SpawnFirework(firework.beat, firework.isSparkler, firework.whereToSpawn, firework.practice, firework.explosionType, firework.applause);
}
queuedFireworks.Clear();
}
@ -182,7 +186,7 @@ namespace HeavenStudio.Games
}
}
public static void PreSpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType)
public static void PreSpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause)
{
if (isSparkler)
{
@ -204,18 +208,18 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat, delegate
{
Fireworks.instance.SpawnFirework(beat, isSparkler, whereToSpawn, practice, explosionType);
Fireworks.instance.SpawnFirework(beat, isSparkler, whereToSpawn, practice, explosionType, applause);
})
});
}
else
{
queuedFireworks.Add(new QueuedFirework { beat = beat, isSparkler = isSparkler, whereToSpawn = whereToSpawn, practice = practice, explosionType = explosionType });
queuedFireworks.Add(new QueuedFirework { beat = beat, isSparkler = isSparkler, whereToSpawn = whereToSpawn, practice = practice, explosionType = explosionType, applause = applause });
}
}
void SpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType)
void SpawnFirework(float beat, bool isSparkler, int whereToSpawn, bool practice, int explosionType, bool applause)
{
if (isSparkler && practice)
{
@ -250,10 +254,11 @@ namespace HeavenStudio.Games
}
Rocket spawnedRocket = Instantiate(firework, spawnPoint, false);
spawnedRocket.isSparkler = isSparkler;
spawnedRocket.applause = applause;
spawnedRocket.Init(beat, explosionType);
}
public void SpawnBomb(float beat, bool practice)
public void SpawnBomb(float beat, bool practice, bool applause)
{
Jukebox.PlayOneShotGame("fireworks/bomb");
if (practice)
@ -269,6 +274,7 @@ namespace HeavenStudio.Games
{
FireworksBomb spawnedBomb = Instantiate(bomb, bombSpawn, false);
spawnedBomb.curve = bombCurve;
spawnedBomb.applause = applause;
spawnedBomb.Init(beat + 1);
})
});

View file

@ -9,6 +9,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks
public class FireworksBomb : PlayerActionObject
{
public BezierCurve3D curve;
public bool applause;
private bool exploded;
private Fireworks game;
private float startBeat;
@ -49,13 +50,14 @@ namespace HeavenStudio.Games.Scripts_Fireworks
return;
}
Success();
Success(caller);
}
void Success()
void Success(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("fireworks/explodeBomb");
game.FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 0.5f);
if (applause) Jukebox.PlayOneShot("applause", caller.timer + caller.startBeat + 1f);
}
void Out(PlayerActionEvent caller) { }

View file

@ -15,6 +15,7 @@ namespace HeavenStudio.Games.Scripts_Fireworks
public bool isSparkler;
private Fireworks game;
public float startBeat;
public bool applause;
private bool exploded;
private float startY;
@ -54,14 +55,15 @@ namespace HeavenStudio.Games.Scripts_Fireworks
anim.gameObject.SetActive(false);
return;
}
Success();
Success(caller);
}
void Success()
void Success(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("fireworks/explodeRocket");
selectedParticleEffect.Play();
anim.gameObject.SetActive(false);
if (applause) Jukebox.PlayOneShot("applause", caller.timer + caller.startBeat + 1f);
}
void Out(PlayerActionEvent caller) { }

View file

@ -31,6 +31,15 @@ namespace HeavenStudio.Games.Loaders
{
function = delegate { RhythmSomen.instance.DoBell(eventCaller.currentEntity.beat); },
},
new GameAction("bop", "Bop")
{
function = delegate { var e = eventCaller.currentEntity; RhythmSomen.instance.ToggleBop(e["toggle"]); },
defaultLength = 0.5f,
parameters = new List<Param>()
{
new Param("toggle", false, "Bop?", "Should the somen man bop or not?")
}
}
});
}
}
@ -51,6 +60,7 @@ namespace HeavenStudio.Games
public Animator CloseCrane;
public Animator FarCrane;
public GameObject Player;
private bool shouldBop = true;
public GameEvent bop = new GameEvent();
@ -66,7 +76,7 @@ namespace HeavenStudio.Games
void Update()
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
{
SomenPlayer.Play("HeadBob", -1, 0);
}
@ -80,6 +90,11 @@ namespace HeavenStudio.Games
}
}
public void ToggleBop(bool bopOrNah)
{
shouldBop = bopOrNah;
}
public void DoFarCrane(float beat)
{
//Far Drop Multisound

View file

@ -11,7 +11,7 @@ namespace HeavenStudio.Games.Loaders
{
public static Minigame AddGame(EventCaller eventCaller)
{
return new Minigame("ringside", "Ringside \n<color=#eb5454>[WIP]</color>", "WUTRU3", false, false, new List<GameAction>()
return new Minigame("ringside", "Ringside", "WUTRU3", false, false, new List<GameAction>()
{
new GameAction("question", "Question")
{

View file

@ -29,6 +29,11 @@ namespace HeavenStudio.Games.Loaders
new Param("volume7", new EntityTypes.Integer(0, 100, 100), "Move Volume 7", "What height and what volume should this move be at?"),
}
},
new GameAction("forceReload", "Bow Force Reload")
{
function = delegate { SneakySpirits.instance.ForceReload(); },
defaultLength = 1f,
},
new GameAction("movebow", "Bow Enter or Exit")
{
function = delegate {var e = eventCaller.currentEntity; SneakySpirits.instance.MoveBow(e.beat, e.length, e["exit"], e["ease"]); },
@ -125,6 +130,13 @@ namespace HeavenStudio.Games
}
}
public void ForceReload()
{
if (hasArrowLoaded) return;
bowAnim.DoScaledAnimationAsync("BowDraw", 0.25f);
hasArrowLoaded = true;
}
public void MoveBow(float beat, float length, bool enter, int ease)
{
movingStartBeat = beat;
@ -180,7 +192,7 @@ namespace HeavenStudio.Games
}
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + length * 3, delegate { bowAnim.DoScaledAnimationAsync("BowDraw", 0.25f); hasArrowLoaded = true; })
new BeatAction.Action(beat + length * 3, delegate { ForceReload(); })
});
List<BeatAction.Action> ghostSpawns = new List<BeatAction.Action>();

View file

@ -14,31 +14,20 @@ namespace HeavenStudio.Games.Loaders
{
return new Minigame("tunnel", "Tunnel \n<color=#eb5454>[WIP]</color>", "B4E6F6", false, false, new List<GameAction>()
{
new GameAction("cowbell", "Cowbell")
{
function = delegate { Tunnel.instance.StartCowbell(eventCaller.currentEntity.beat, eventCaller.currentEntity["toggle"], eventCaller.currentEntity.length); },
defaultLength = 1f,
preFunction = delegate { Tunnel.PreStartCowbell(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); },
defaultLength = 4f,
resizable = true,
parameters = new List<Param>()
{
new Param("toggle", false, "Driver can stop", "Lets the driver stop if the player makes too many mistakes"),
}
},
new GameAction("countin", "Count In")
{
function = delegate { Tunnel.instance.CountIn(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); },
defaultLength = 3f,
preFunction = delegate { Tunnel.CountIn(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); },
defaultLength = 4f,
resizable = true,
}
}
//new List<string>() {"ntr", "aim"},
//"ntrcoin", "en",
//new List<string>() {}
);
});
}
}
}
@ -47,11 +36,8 @@ namespace HeavenStudio.Games
{
public class Tunnel : Minigame
{
public static Tunnel instance { get; set; }
[Header("Backgrounds")]
public SpriteRenderer fg;
public SpriteRenderer bg;
@ -80,12 +66,22 @@ namespace HeavenStudio.Games
public float handStart;
public float handProgress;
public bool started;
public struct QueuedCowbell
{
public float beat;
public float length;
}
static List<QueuedCowbell> queuedInputs = new List<QueuedCowbell>();
private void Awake()
{
instance = this;
}
void OnDestroy()
{
if (queuedInputs.Count > 0) queuedInputs.Clear();
}
private void Start()
{
@ -97,34 +93,30 @@ namespace HeavenStudio.Games
{
var cond = Conductor.instance;
if (cond.ReportBeat(ref cowbell.lastReportedBeat, cowbell.startBeat % 1))
{
if (cond.songPositionInBeats >= cowbell.startBeat && cond.songPositionInBeats < cowbell.startBeat + cowbell.length)
{
ScheduleInput(cond.songPositionInBeats, 1, InputType.STANDARD_DOWN, CowbellSuccess, CowbellMiss, CowbellEmpty);
}
}
//update hand position
handProgress = Math.Min(Conductor.instance.songPositionInBeats - handStart, 1);
frontHand.transform.position = handCurve.GetPoint(EasingFunction.EaseOutQuad(0, 1, handProgress));
if (!cond.isPlaying || cond.isPaused)
{
return;
}
if (PlayerInput.Pressed() && !IsExpectingInputNow())
{
HitCowbell();
//print("unexpected input");
driverAnimator.Play("Angry1", -1, 0);
}
//update hand position
handProgress = Math.Min(Conductor.instance.songPositionInBeats - handStart, 1);
frontHand.transform.position = handCurve.GetPoint(EasingFunction.EaseOutQuad(0, 1, handProgress));
if (queuedInputs.Count > 0)
{
foreach (var input in queuedInputs)
{
StartCowbell(input.beat, input.length);
}
queuedInputs.Clear();
}
private void LateUpdate()
{
//nothing
}
@ -137,27 +129,32 @@ namespace HeavenStudio.Games
cowbellAnimator.Play("Shake",-1,0);
}
public void StartCowbell(float beat, bool driverStops, float length)
public static void PreStartCowbell(float beat, float length)
{
if (GameManager.instance.currentGame == "tunnel")
{
instance.StartCowbell(beat, length);
}
else
{
queuedInputs.Add(new QueuedCowbell { beat = beat, length = length });
}
}
public void StartCowbell(float beat, float length)
{
started = true;
cowbell.length = length;
cowbell.startBeat = beat;
//for (int i = 1; i <= length; i++)
//{
//ScheduleInput(beat, i, InputType.STANDARD_DOWN, CowbellSuccess, CowbellMiss, CowbellEmpty);
//}
for(int i = 0; i < length; i++)
{
ScheduleInput(beat, i, InputType.STANDARD_DOWN, CowbellSuccess, CowbellMiss, CowbellEmpty);
}
}
public void CowbellSuccess(PlayerActionEvent caller, float state)
{
HitCowbell();
//print(state);
if(Math.Abs(state) >= 0.5)
if(Math.Abs(state) >= 1f)
{
driverAnimator.Play("Disturbed", -1, 0);
@ -184,13 +181,13 @@ namespace HeavenStudio.Games
public void CountIn(float beat, float length)
public static void CountIn(float beat, float length)
{
List<MultiSound.Sound> cuelist = new List<MultiSound.Sound>();
for (int i = 0; i <= length; i++)
for (int i = 0; i < length; i++)
{
if(i % 2 == 0)
{
@ -206,7 +203,7 @@ namespace HeavenStudio.Games
}
}
MultiSound.Play(cuelist.ToArray());
MultiSound.Play(cuelist.ToArray(), forcePlay: true);
}