mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:57:40 +02:00
Clappy Trio and Fork Lifter finished + small additions/fixes (#400)
* The funny * Yar har har har * 1 two tree * Hilarious! * procedurally spawning in stuff * bored meeting * A lot! * Assistant stop added * Added Bops * Added Sounds * Added miss stuff!! Only need the miss anim for the pigs!!! * Tweaks * Bugfixes! * anim fix anim fix * STRAIGHT! * Sound offsets fixed * added the new anims to implement * new sheet * loopSpin implemented * woah * mis stuff * doen done done * Various fixes * Fixed clappy trio bop bug * Epic tings * Added color and screen shake * Small things * redid sheets a little * Fixed burger preview * Almost done with forklifter * Bg color and fixed 4 peas for fork lifter * icon * bg stuff for tambourine and forklfiter --------- Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
This commit is contained in:
8
Assets/Scripts/Games/BoardMeeting.meta
Normal file
8
Assets/Scripts/Games/BoardMeeting.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afef4c7006c596841aabe668df3c18cb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
100
Assets/Scripts/Games/BoardMeeting/BMExecutive.cs
Normal file
100
Assets/Scripts/Games/BoardMeeting/BMExecutive.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_BoardMeeting
|
||||
{
|
||||
public class BMExecutive : MonoBehaviour
|
||||
{
|
||||
public BoardMeeting game;
|
||||
public bool player;
|
||||
public Animator anim;
|
||||
bool canBop = true;
|
||||
int smileCounter = 0;
|
||||
public bool spinning;
|
||||
bool preparing;
|
||||
Sound rollLoop = null;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
game = BoardMeeting.instance;
|
||||
}
|
||||
|
||||
public void Prepare()
|
||||
{
|
||||
if (spinning) return;
|
||||
preparing = true;
|
||||
anim.DoScaledAnimationAsync("Prepare", 0.5f);
|
||||
canBop = false;
|
||||
}
|
||||
|
||||
public void Spin(string soundToPlay = "A")
|
||||
{
|
||||
if (spinning) return;
|
||||
spinning = true;
|
||||
preparing = false;
|
||||
if (this == game.firstSpinner) anim.DoUnscaledAnimation("Spin");
|
||||
else anim.DoUnscaledAnimation("Spin", game.firstSpinner.anim.GetCurrentAnimatorStateInfo(0).normalizedTime);
|
||||
canBop = false;
|
||||
Jukebox.PlayOneShotGame("boardMeeting/rollPrepare" + soundToPlay);
|
||||
float offset = 0;
|
||||
switch (soundToPlay)
|
||||
{
|
||||
case "A":
|
||||
case "B":
|
||||
offset = 0.01041666666f;
|
||||
break;
|
||||
case "C":
|
||||
case "Player":
|
||||
offset = 0.02083333333f;
|
||||
break;
|
||||
default:
|
||||
offset = 0;
|
||||
break;
|
||||
}
|
||||
rollLoop = Jukebox.PlayOneShotGame("boardMeeting/roll" + soundToPlay, Conductor.instance.songPositionInBeats + 0.5f - Conductor.instance.GetRestFromRealTime(offset), 1, 1, true);
|
||||
}
|
||||
|
||||
public void Stop(bool hit = true)
|
||||
{
|
||||
if (!spinning) return;
|
||||
spinning = false;
|
||||
anim.DoScaledAnimationAsync(hit ? "Stop" : "Miss", hit ? 0.5f : 0.25f);
|
||||
if (rollLoop != null)
|
||||
{
|
||||
rollLoop.KillLoop(0);
|
||||
rollLoop = null;
|
||||
}
|
||||
|
||||
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(Conductor.instance.songPositionInBeats + 1.5f, delegate { canBop = true; })
|
||||
});
|
||||
}
|
||||
|
||||
public void Bop()
|
||||
{
|
||||
if (!canBop || spinning || !anim.IsAnimationNotPlaying() || preparing) return;
|
||||
if (smileCounter > 0)
|
||||
{
|
||||
anim.DoScaledAnimationAsync("SmileBop", 0.5f);
|
||||
smileCounter--;
|
||||
}
|
||||
else
|
||||
{
|
||||
anim.DoScaledAnimationAsync("Bop", 0.5f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Smile()
|
||||
{
|
||||
if (spinning) return;
|
||||
if (!preparing) anim.Play("SmileIdle");
|
||||
smileCounter = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Assets/Scripts/Games/BoardMeeting/BMExecutive.cs.meta
Normal file
11
Assets/Scripts/Games/BoardMeeting/BMExecutive.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d92a169b894684429df3bc113698228
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
438
Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs
Normal file
438
Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs
Normal file
@ -0,0 +1,438 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using HeavenStudio.Util;
|
||||
using DG.Tweening;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
using static Minigames;
|
||||
|
||||
public static class RvlBoardMeetingLoader
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller)
|
||||
{
|
||||
return new Minigame("boardMeeting", "Board Meeting", "d37912", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("prepare", "Prepare")
|
||||
{
|
||||
function = delegate { BoardMeeting.instance.Prepare(); }
|
||||
},
|
||||
new GameAction("spinEqui", "Spin")
|
||||
{
|
||||
function = delegate {var e = eventCaller.currentEntity; BoardMeeting.instance.SpinEqui(e.beat, e.length); },
|
||||
resizable = true,
|
||||
priority = 2
|
||||
},
|
||||
new GameAction("spin", "Spin (Range)")
|
||||
{
|
||||
function = delegate {var e = eventCaller.currentEntity; BoardMeeting.instance.Spin(e["start"], e["end"]); },
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("start", new EntityTypes.Integer(1, 6, 1), "Starting Pig", "Which pig from the far left (1) or far right (4) should be the first to spin?"),
|
||||
new Param("end", new EntityTypes.Integer(1, 6, 4), "Ending Pig", "Which pig from the far left (1) or far right (4) should be the last to spin?")
|
||||
},
|
||||
priority = 2
|
||||
},
|
||||
new GameAction("stop", "Stop")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; BoardMeeting.instance.Stop(e.beat, e.length); },
|
||||
resizable = true,
|
||||
priority = 1
|
||||
},
|
||||
new GameAction("assStop", "Assistant Stop")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; BoardMeeting.instance.AssistantStop(e.beat); },
|
||||
defaultLength = 3f
|
||||
},
|
||||
new GameAction("bop", "Bop")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; BoardMeeting.instance.Bop(e.beat, e.length, e["bop"], e["auto"]); },
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("bop", true, "Bop", "Should the executives and assistant bop?"),
|
||||
new Param("auto", false, "Bop (Auto)", "Should the executives and assistant auto bop?")
|
||||
}
|
||||
},
|
||||
new GameAction("changeCount", "Change Executives")
|
||||
{
|
||||
function = delegate { BoardMeeting.instance.ChangeExecutiveCount(eventCaller.currentEntity["amount"]); },
|
||||
defaultLength = 0.5f,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("amount", new EntityTypes.Integer(3, 6, 4), "Amount", "How many executives will there be?")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
using Scripts_BoardMeeting;
|
||||
|
||||
public class BoardMeeting : Minigame
|
||||
{
|
||||
[Header("Components")]
|
||||
[SerializeField] Transform farLeft;
|
||||
[SerializeField] Transform farRight;
|
||||
[SerializeField] Animator assistantAnim;
|
||||
|
||||
[Header("Properties")]
|
||||
[SerializeField] int executiveCount = 4;
|
||||
[SerializeField] List<BMExecutive> executives = new List<BMExecutive>();
|
||||
public BMExecutive firstSpinner;
|
||||
[SerializeField] float shakeIntensity = 0.5f;
|
||||
public bool shouldBop = true;
|
||||
bool assistantCanBop = true;
|
||||
bool executivesCanBop = true;
|
||||
public GameEvent bop = new GameEvent();
|
||||
Sound chairLoopSound = null;
|
||||
int missCounter = 0;
|
||||
private Tween shakeTween;
|
||||
|
||||
public static BoardMeeting instance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
InitExecutives();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
|
||||
if (cond.isPlaying && !cond.isPaused)
|
||||
{
|
||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1) && shouldBop)
|
||||
{
|
||||
SingleBop();
|
||||
}
|
||||
if(PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
|
||||
{
|
||||
if (executives[executiveCount - 1].spinning)
|
||||
{
|
||||
executives[executiveCount - 1].Stop(false);
|
||||
Jukebox.PlayOneShotGame("boardMeeting/miss");
|
||||
Jukebox.PlayOneShot("miss");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SingleBop()
|
||||
{
|
||||
if (assistantCanBop)
|
||||
{
|
||||
if (missCounter > 0) assistantAnim.DoScaledAnimationAsync("MissBop", 0.5f);
|
||||
else assistantAnim.DoScaledAnimationAsync("Bop", 0.5f);
|
||||
}
|
||||
if (missCounter > 0) missCounter--;
|
||||
if (!executivesCanBop) return;
|
||||
foreach (var executive in executives)
|
||||
{
|
||||
executive.Bop();
|
||||
}
|
||||
}
|
||||
|
||||
public void Bop(float beat, float length, bool goBop, bool autoBop)
|
||||
{
|
||||
shouldBop = autoBop;
|
||||
if (goBop)
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + i, delegate
|
||||
{
|
||||
SingleBop();
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AssistantStop(float beat)
|
||||
{
|
||||
assistantCanBop = false;
|
||||
string twoSound = "boardMeeting/two";
|
||||
if (beat % 1 != 0) twoSound = "boardMeeting/twoUra";
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("boardMeeting/one", beat),
|
||||
new MultiSound.Sound(twoSound, beat + 0.5f),
|
||||
new MultiSound.Sound("boardMeeting/three", beat + 1),
|
||||
new MultiSound.Sound("boardMeeting/stopAll", beat + 2)
|
||||
});
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { assistantAnim.DoScaledAnimationAsync("One", 0.5f); }),
|
||||
new BeatAction.Action(beat + 1, delegate { assistantAnim.DoScaledAnimationAsync("Three", 0.5f); }),
|
||||
new BeatAction.Action(beat + 2, delegate
|
||||
{
|
||||
foreach (var executive in executives)
|
||||
{
|
||||
if (executive.player) continue;
|
||||
executive.Stop();
|
||||
}
|
||||
if (!executives[executiveCount - 1].spinning)
|
||||
{
|
||||
if (chairLoopSound != null)
|
||||
{
|
||||
chairLoopSound.KillLoop(0);
|
||||
chairLoopSound = null;
|
||||
}
|
||||
}
|
||||
}),
|
||||
new BeatAction.Action(beat + 2.5f, delegate { assistantCanBop = true; })
|
||||
});
|
||||
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JustAssistant, MissAssistant, Empty);
|
||||
}
|
||||
|
||||
public void Stop(float beat, float length)
|
||||
{
|
||||
executivesCanBop = false;
|
||||
List<BeatAction.Action> stops = new List<BeatAction.Action>();
|
||||
for (int i = 0; i < executiveCount; i++)
|
||||
{
|
||||
if (executives[i].player) break;
|
||||
int index = i;
|
||||
stops.Add(new BeatAction.Action(beat + length * i, delegate
|
||||
{
|
||||
int ex = executiveCount;
|
||||
if (executiveCount < 4) ex = 4;
|
||||
if (index < ex - 3)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("boardMeeting/stopA");
|
||||
}
|
||||
else if (index == ex - 3)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("boardMeeting/stopB");
|
||||
}
|
||||
else if (index == ex - 2)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("boardMeeting/stopC");
|
||||
}
|
||||
|
||||
if (index == executiveCount - 2 && !executives[executiveCount - 1].spinning)
|
||||
{
|
||||
if (chairLoopSound != null)
|
||||
{
|
||||
chairLoopSound.KillLoop(0);
|
||||
chairLoopSound = null;
|
||||
}
|
||||
}
|
||||
executives[index].Stop();
|
||||
}));
|
||||
}
|
||||
stops.Add(new BeatAction.Action(beat + length * executiveCount + 0.5f, delegate { executivesCanBop = true; }));
|
||||
BeatAction.New(instance.gameObject, stops);
|
||||
ScheduleInput(beat, length * (executiveCount - 1), InputType.STANDARD_DOWN, Just, Miss, Empty);
|
||||
}
|
||||
|
||||
public void Prepare()
|
||||
{
|
||||
Jukebox.PlayOneShotGame("boardMeeting/prepare");
|
||||
foreach (var executive in executives)
|
||||
{
|
||||
executive.Prepare();
|
||||
}
|
||||
}
|
||||
|
||||
public void SpinEqui(float beat, float length)
|
||||
{
|
||||
if (chairLoopSound == null) chairLoopSound = Jukebox.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true);
|
||||
firstSpinner = executives[0];
|
||||
List<BeatAction.Action> rolls = new List<BeatAction.Action>();
|
||||
for (int i = 0; i < executiveCount; i++)
|
||||
{
|
||||
int index = i;
|
||||
rolls.Add(new BeatAction.Action(beat + length * i, delegate
|
||||
{
|
||||
int ex = executiveCount;
|
||||
string soundToPlay = "A";
|
||||
if (executiveCount < 4) ex = 4;
|
||||
if (index == ex - 3)
|
||||
{
|
||||
soundToPlay = "B";
|
||||
}
|
||||
else if (index == ex - 2)
|
||||
{
|
||||
soundToPlay = "C";
|
||||
}
|
||||
else if (index == ex - 1)
|
||||
{
|
||||
soundToPlay = "Player";
|
||||
}
|
||||
executives[index].Spin(soundToPlay);
|
||||
}));
|
||||
}
|
||||
BeatAction.New(instance.gameObject, rolls);
|
||||
|
||||
}
|
||||
|
||||
public void Spin(int start, int end)
|
||||
{
|
||||
if (start > executiveCount || end > executiveCount) return;
|
||||
if (chairLoopSound == null)
|
||||
{
|
||||
chairLoopSound = Jukebox.PlayOneShotGame("boardMeeting/chairLoop", -1, 1, 1, true);
|
||||
firstSpinner = executives[start - 1];
|
||||
}
|
||||
for (int i = start - 1; i < end; i++)
|
||||
{
|
||||
int ex = executiveCount;
|
||||
string soundToPlay = "A";
|
||||
if (executiveCount < 4) ex = 4;
|
||||
if (i == ex - 3)
|
||||
{
|
||||
soundToPlay = "B";
|
||||
}
|
||||
else if (i == ex - 2)
|
||||
{
|
||||
soundToPlay = "C";
|
||||
}
|
||||
else if (i == ex - 1)
|
||||
{
|
||||
soundToPlay = "Player";
|
||||
}
|
||||
executives[i].Spin(soundToPlay);
|
||||
}
|
||||
}
|
||||
|
||||
public void InitExecutives()
|
||||
{
|
||||
float startPos = farLeft.position.x;
|
||||
float maxWidth = Mathf.Abs(farLeft.position.x - farRight.position.x);
|
||||
|
||||
for (int i = 0; i < executiveCount; i++)
|
||||
{
|
||||
BMExecutive executive;
|
||||
if (i == 0) executive = executives[0];
|
||||
else executive = Instantiate(executives[0], transform);
|
||||
|
||||
executive.transform.localPosition = new Vector3(startPos + ((maxWidth / (executiveCount - 1)) * i), 0);
|
||||
executive.GetComponent<SortingGroup>().sortingOrder = i;
|
||||
|
||||
if (i > 0)
|
||||
executives.Add(executive);
|
||||
|
||||
if (i == executiveCount - 1)
|
||||
executive.player = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeExecutiveCount(int count)
|
||||
{
|
||||
for (int i = 1; i < executiveCount; i++)
|
||||
{
|
||||
Destroy(executives[i].gameObject);
|
||||
}
|
||||
executives.RemoveRange(1, executiveCount - 1);
|
||||
executiveCount = count;
|
||||
InitExecutives();
|
||||
}
|
||||
|
||||
void Just(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (chairLoopSound != null)
|
||||
{
|
||||
chairLoopSound.KillLoop(0);
|
||||
chairLoopSound = null;
|
||||
}
|
||||
if (state >= 1f || state <= -1f)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("boardMeeting/missThrough");
|
||||
Jukebox.PlayOneShot("miss");
|
||||
executives[executiveCount - 1].Stop(false);
|
||||
return;
|
||||
}
|
||||
Jukebox.PlayOneShotGame("boardMeeting/stopPlayer");
|
||||
executives[executiveCount - 1].Stop();
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(caller.timer + caller.startBeat + 1f, delegate
|
||||
{
|
||||
foreach (var executive in executives)
|
||||
{
|
||||
executive.Smile();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
void JustAssistant(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (chairLoopSound != null)
|
||||
{
|
||||
chairLoopSound.KillLoop(0);
|
||||
chairLoopSound = null;
|
||||
}
|
||||
if (state >= 1f || state <= -1f)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("boardMeeting/missThrough");
|
||||
Jukebox.PlayOneShot("miss");
|
||||
executives[executiveCount - 1].Stop(false);
|
||||
return;
|
||||
}
|
||||
if (shakeTween != null)
|
||||
shakeTween.Kill(true);
|
||||
|
||||
DOTween.Punch(() => GameCamera.additionalPosition, x => GameCamera.additionalPosition = x, new Vector3(shakeIntensity, 0, 0),
|
||||
Conductor.instance.pitchedSecPerBeat * 0.5f, 18, 1f);
|
||||
executives[executiveCount - 1].Stop();
|
||||
assistantAnim.DoScaledAnimationAsync("Stop", 0.5f);
|
||||
Jukebox.PlayOneShotGame("boardMeeting/stopAllPlayer");
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(caller.timer + caller.startBeat + 1f, delegate
|
||||
{
|
||||
foreach (var executive in executives)
|
||||
{
|
||||
executive.Smile();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
void Miss(PlayerActionEvent caller)
|
||||
{
|
||||
if (executives[executiveCount - 1].spinning)
|
||||
{
|
||||
executives[executiveCount - 1].Stop(false);
|
||||
Jukebox.PlayOneShotGame("boardMeeting/missThrough");
|
||||
Jukebox.PlayOneShot("miss");
|
||||
if (chairLoopSound != null)
|
||||
{
|
||||
chairLoopSound.KillLoop(0);
|
||||
chairLoopSound = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MissAssistant(PlayerActionEvent caller)
|
||||
{
|
||||
if (executives[executiveCount - 1].spinning)
|
||||
{
|
||||
executives[executiveCount - 1].Stop(false);
|
||||
Jukebox.PlayOneShotGame("boardMeeting/missThrough");
|
||||
Jukebox.PlayOneShot("miss");
|
||||
if (chairLoopSound != null)
|
||||
{
|
||||
chairLoopSound.KillLoop(0);
|
||||
chairLoopSound = null;
|
||||
}
|
||||
}
|
||||
assistantAnim.Play("MissIdle", 0, 0);
|
||||
missCounter = 2;
|
||||
}
|
||||
|
||||
void Empty(PlayerActionEvent caller) { }
|
||||
}
|
||||
}
|
||||
|
11
Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs.meta
Normal file
11
Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 257f3dae2f7b7ed43b0133a7f2ac3447
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -35,6 +35,15 @@ namespace HeavenStudio.Games.Loaders
|
||||
new Param("toggle", false, "Alt", "Whether or not the alternate version should be played")
|
||||
}
|
||||
},
|
||||
new GameAction("sign", "Sign Enter")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; ClappyTrio.instance.Sign(e.beat, e.length, e["ease"]); },
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("ease", EasingFunction.Ease.Linear, "Ease", "Which ease should the sign move with?"),
|
||||
},
|
||||
resizable = true
|
||||
},
|
||||
new GameAction("change lion count", "Change Lion Count")
|
||||
{
|
||||
function = delegate { ClappyTrio.instance.ChangeLionCount((int)eventCaller.currentEntity["valA"]); },
|
||||
@ -75,10 +84,16 @@ namespace HeavenStudio.Games
|
||||
private ClappyTrioPlayer ClappyTrioPlayer;
|
||||
|
||||
public bool playerHitLast = false;
|
||||
public bool missed;
|
||||
bool shouldBop;
|
||||
|
||||
public GameEvent bop = new GameEvent();
|
||||
|
||||
[SerializeField] Animator signAnim;
|
||||
float signStartBeat;
|
||||
float signLength;
|
||||
EasingFunction.Ease lastEase;
|
||||
|
||||
public static ClappyTrio instance { get; set; }
|
||||
|
||||
MultiSound clapSounds = null;
|
||||
@ -106,6 +121,24 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
if (shouldBop) Bop(cond.songPositionInBeats);
|
||||
}
|
||||
if (cond.isPlaying && !cond.isPaused)
|
||||
{
|
||||
float normalizedBeat = cond.GetPositionFromBeat(signStartBeat, signLength);
|
||||
|
||||
if (normalizedBeat > 0 && normalizedBeat <= 1)
|
||||
{
|
||||
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase);
|
||||
float newPos = func(0, 1, normalizedBeat);
|
||||
signAnim.DoNormalizedAnimation("Enter", newPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Sign(float beat, float length, int ease)
|
||||
{
|
||||
signStartBeat = beat;
|
||||
signLength = length;
|
||||
lastEase = (EasingFunction.Ease)ease;
|
||||
}
|
||||
|
||||
private void InitLions()
|
||||
@ -195,7 +228,8 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
SetFace(i, 1);
|
||||
}
|
||||
} else
|
||||
}
|
||||
else if (missed)
|
||||
{
|
||||
var a = EventCaller.GetAllInGameManagerList("clappyTrio", new string[] { "clap" });
|
||||
var b = a.FindAll(c => c.beat < beat);
|
||||
|
@ -55,6 +55,7 @@ namespace HeavenStudio.Games.Scripts_ClappyTrio
|
||||
|
||||
private void Miss(PlayerActionEvent caller) {
|
||||
game.playerHitLast = false;
|
||||
game.missed = true;
|
||||
|
||||
if (clapStarted)
|
||||
this.canHit = false;
|
||||
@ -77,6 +78,7 @@ namespace HeavenStudio.Games.Scripts_ClappyTrio
|
||||
clapEffect.SetActive(false);
|
||||
Jukebox.PlayOneShot("miss");
|
||||
game.playerHitLast = false;
|
||||
game.missed = true;
|
||||
|
||||
if (clapStarted)
|
||||
this.canHit = false;
|
||||
|
@ -26,7 +26,11 @@ namespace HeavenStudio.Games.Loaders
|
||||
},
|
||||
new GameAction("mole", "Mole")
|
||||
{
|
||||
defaultLength = 2f
|
||||
defaultLength = 2f,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("mute", false, "Mute", "Should the mole laugh sound be muted?")
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -203,6 +207,7 @@ namespace HeavenStudio.Games
|
||||
for (int i = 0; i < moleEvents.Count; i++)
|
||||
{
|
||||
var moleEvent = moleEvents[i];
|
||||
if (moleEvent["mute"]) continue;
|
||||
var timeToEvent = moleEvent.beat - cond.songPositionInBeats;
|
||||
if (timeToEvent <= 4f && timeToEvent > 2f && !cuedMoleSounds.Contains(moleEvent))
|
||||
{
|
||||
|
@ -37,6 +37,28 @@ namespace HeavenStudio.Games.Loaders
|
||||
|
||||
function = delegate { Jukebox.PlayOneShot("games/forkLifter/sigh"); }
|
||||
},
|
||||
new GameAction("color", "Background Color")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.FadeBackgroundColor(e["start"], e["end"], e.length, e["instant"]); },
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("start", Color.white, "Start Color", "The color to start fading from."),
|
||||
new Param("end", Color.white, "End Color", "The color to end the fade."),
|
||||
new Param("instant", false, "Instant", "If checked, the background color will instantly change to the start color.")
|
||||
},
|
||||
resizable = true
|
||||
},
|
||||
new GameAction("colorGrad", "Gradient Color")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.FadeGradientColor(e["start"], e["end"], e.length, e["instant"]); },
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("start", Color.white, "Start Color", "The color to start fading from."),
|
||||
new Param("end", Color.white, "End Color", "The color to end the fade."),
|
||||
new Param("instant", false, "Instant", "If checked, the gradient color will instantly change to the start color.")
|
||||
},
|
||||
resizable = true
|
||||
},
|
||||
// These are still here for backwards-compatibility but are hidden in the editor
|
||||
new GameAction("pea", "")
|
||||
{
|
||||
@ -92,6 +114,16 @@ namespace HeavenStudio.Games
|
||||
public Animator handAnim;
|
||||
public GameObject flickedObject;
|
||||
public SpriteRenderer peaPreview;
|
||||
[SerializeField] SpriteRenderer bg;
|
||||
[SerializeField] SpriteRenderer bgGradient;
|
||||
[SerializeField] SpriteRenderer viewerCircle;
|
||||
[SerializeField] SpriteRenderer playerShadow;
|
||||
[SerializeField] SpriteRenderer handShadow;
|
||||
Tween bgColorTween;
|
||||
Tween bgGradientColorTween;
|
||||
Tween viewerCircleColorTween;
|
||||
Tween playerShadowColorTween;
|
||||
Tween handShadowColorTween;
|
||||
|
||||
public Sprite[] peaSprites;
|
||||
public Sprite[] peaHitSprites;
|
||||
@ -111,6 +143,7 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
Jukebox.PlayOneShotGame("forkLifter/flick");
|
||||
handAnim.Play("Hand_Flick", 0, 0);
|
||||
ForkLifterHand.currentFlickIndex++;
|
||||
GameObject fo = Instantiate(flickedObject);
|
||||
fo.transform.parent = flickedObject.transform.parent;
|
||||
Pea pea = fo.GetComponent<Pea>();
|
||||
@ -118,6 +151,62 @@ namespace HeavenStudio.Games
|
||||
pea.type = type;
|
||||
fo.SetActive(true);
|
||||
}
|
||||
|
||||
public void ChangeBackgroundColor(Color color, float beats)
|
||||
{
|
||||
var seconds = Conductor.instance.secPerBeat * beats;
|
||||
|
||||
if (bgColorTween != null)
|
||||
bgColorTween.Kill(true);
|
||||
if (viewerCircleColorTween != null)
|
||||
viewerCircleColorTween.Kill(true);
|
||||
if (handShadowColorTween != null) handShadowColorTween.Kill(true);
|
||||
|
||||
if (seconds == 0)
|
||||
{
|
||||
bg.color = color;
|
||||
viewerCircle.color = color;
|
||||
handShadow.color = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
bgColorTween = bg.DOColor(color, seconds);
|
||||
handShadowColorTween = handShadow.DOColor(color, seconds);
|
||||
viewerCircleColorTween = viewerCircle.DOColor(color, seconds);
|
||||
}
|
||||
}
|
||||
|
||||
public void FadeBackgroundColor(Color start, Color end, float beats, bool instant)
|
||||
{
|
||||
ChangeBackgroundColor(start, 0f);
|
||||
if (!instant) ChangeBackgroundColor(end, beats);
|
||||
}
|
||||
|
||||
public void ChangeGradientColor(Color color, float beats)
|
||||
{
|
||||
var seconds = Conductor.instance.secPerBeat * beats;
|
||||
|
||||
if (bgGradientColorTween != null)
|
||||
bgGradientColorTween.Kill(true);
|
||||
if (playerShadowColorTween != null) playerShadowColorTween.Kill(true);
|
||||
|
||||
if (seconds == 0)
|
||||
{
|
||||
bgGradient.color = color;
|
||||
playerShadow.color = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
bgGradientColorTween = bgGradient.DOColor(color, seconds);
|
||||
playerShadowColorTween = playerShadow.DOColor(color, seconds);
|
||||
}
|
||||
}
|
||||
|
||||
public void FadeGradientColor(Color start, Color end, float beats, bool instant)
|
||||
{
|
||||
ChangeGradientColor(start, 0f);
|
||||
if (!instant) ChangeGradientColor(end, beats);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -13,29 +13,43 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
|
||||
|
||||
public Sprite[] fastSprites;
|
||||
|
||||
private List<DynamicBeatmap.DynamicEntity> allFlickEntities = new List<DynamicBeatmap.DynamicEntity>();
|
||||
|
||||
public int currentFlickIndex;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
var flickEntities = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "flick" });
|
||||
List<DynamicBeatmap.DynamicEntity> tempEvents = new List<DynamicBeatmap.DynamicEntity>();
|
||||
for (int i = 0; i < flickEntities.Count; i++)
|
||||
{
|
||||
if (flickEntities[i].beat >= Conductor.instance.songPositionInBeats)
|
||||
{
|
||||
tempEvents.Add(flickEntities[i]);
|
||||
}
|
||||
}
|
||||
allFlickEntities = tempEvents;
|
||||
}
|
||||
|
||||
public void CheckNextFlick()
|
||||
{
|
||||
// var allPlayerActions = EventCaller.GetAllInGameManagerList("forkLifter", new string[] { "gulp", "sigh", "prepare" });
|
||||
// var allPlayerActions = EventCaller.GetAllPlayerEntities("forkLifter");
|
||||
// int currentPlayerEvent = GameManager.instance.currentEvent - EventCaller.GetAllPlayerEntitiesExceptBeforeBeat("forkLifter", Conductor.instance.songPositionInBeats).Count;
|
||||
|
||||
/* if (currentPlayerEvent < allPlayerActions.Count)
|
||||
if (allFlickEntities.Count > 0 && currentFlickIndex >= 0 && currentFlickIndex < allFlickEntities.Count)
|
||||
{
|
||||
switch (allPlayerActions[currentPlayerEvent].datamodel.Split('/')[1])
|
||||
switch (allFlickEntities[currentFlickIndex]["type"])
|
||||
{
|
||||
case "pea":
|
||||
case (int)ForkLifter.FlickType.Pea:
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[0];
|
||||
fastSprite.sprite = fastSprites[0];
|
||||
break;
|
||||
case "topbun":
|
||||
case (int)ForkLifter.FlickType.TopBun:
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[1];
|
||||
fastSprite.sprite = fastSprites[0];
|
||||
break;
|
||||
case "burger":
|
||||
case (int)ForkLifter.FlickType.Burger:
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[2];
|
||||
fastSprite.sprite = fastSprites[1];
|
||||
break;
|
||||
case "bottombun":
|
||||
case (int)ForkLifter.FlickType.BottomBun:
|
||||
ForkLifter.instance.peaPreview.sprite = ForkLifter.instance.peaSprites[3];
|
||||
fastSprite.sprite = fastSprites[0];
|
||||
break;
|
||||
@ -44,9 +58,7 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
|
||||
else
|
||||
{
|
||||
ForkLifter.instance.peaPreview.sprite = null;
|
||||
}*/
|
||||
|
||||
// will fix later
|
||||
}
|
||||
}
|
||||
|
||||
public void Prepare()
|
||||
|
@ -52,9 +52,13 @@ namespace HeavenStudio.Games.Scripts_ForkLifter
|
||||
|
||||
pea.transform.localPosition = Vector3.zero;
|
||||
|
||||
float peaOffset = 0;
|
||||
|
||||
if (ForkLifterPlayer.instance.currentPerfectPeasOnFork == 3) peaOffset = -0.15724f;
|
||||
|
||||
for (int i = 0; i < ForkLifterPlayer.instance.perfect.transform.childCount; i++)
|
||||
{
|
||||
ForkLifterPlayer.instance.perfect.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * ForkLifterPlayer.instance.currentPerfectPeasOnFork);
|
||||
ForkLifterPlayer.instance.perfect.transform.GetChild(i).transform.localPosition = new Vector3(0, (-1.67f - (0.15724f * i)) + 0.15724f * ForkLifterPlayer.instance.currentPerfectPeasOnFork + peaOffset);
|
||||
}
|
||||
|
||||
SpriteRenderer psprite = pea.AddComponent<SpriteRenderer>();
|
||||
|
@ -25,12 +25,13 @@ namespace HeavenStudio.Games.Loaders
|
||||
inactiveFunction = delegate { KarateMan.ToggleBopUnloaded(eventCaller.currentEntity["toggle"]); }
|
||||
},
|
||||
new GameAction("hit", "Toss Object") {
|
||||
function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.CreateItem(e.beat, e["type"], e["type2"]); },
|
||||
function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.CreateItem(e.beat, e["type"], e["type2"], e["mute"]); },
|
||||
defaultLength = 2,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("type", KarateMan.HitType.Pot, "Object", "The object to fire"),
|
||||
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 GameAction("bulb", "Toss Lightbulb")
|
||||
@ -695,7 +696,7 @@ namespace HeavenStudio.Games
|
||||
return word;
|
||||
}
|
||||
|
||||
public void CreateItem(float beat, int type, int expression)
|
||||
public void CreateItem(float beat, int type, int expression, bool muteSound = false)
|
||||
{
|
||||
|
||||
string outSound;
|
||||
@ -739,7 +740,7 @@ namespace HeavenStudio.Games
|
||||
CreateItemInstance(beat, "Item00", expression);
|
||||
break;
|
||||
}
|
||||
Jukebox.PlayOneShotGame(outSound, forcePlay: true);
|
||||
if (!muteSound) Jukebox.PlayOneShotGame(outSound, forcePlay: true);
|
||||
}
|
||||
|
||||
public void CreateBulbSpecial(float beat, int type, Color c, int expression)
|
||||
|
@ -11,7 +11,7 @@ namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller)
|
||||
{
|
||||
return new Minigame("quizShow", "Quiz Show", "0058CE", false, false, new List<GameAction>()
|
||||
return new Minigame("quizShow", "Quiz Show", "c96efa", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("intervalStart", "Start Interval")
|
||||
{
|
||||
|
@ -56,6 +56,19 @@ namespace HeavenStudio.Games.Loaders
|
||||
defaultLength = 1f,
|
||||
priority = 4,
|
||||
},
|
||||
new GameAction("fade background", "Background Color")
|
||||
{
|
||||
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.FadeBackgroundColor(e["colorA"], e["colorB"], e.length, e["instant"]); },
|
||||
defaultLength = 4f,
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("colorA", Color.white, "Start Color", "The starting color of the fade."),
|
||||
new Param("colorB", Tambourine.defaultBGColor, "End Color", "The ending color of the fade."),
|
||||
new Param("instant", false, "Instant", "Instantly set the color of the background to the start color?")
|
||||
}
|
||||
},
|
||||
//backwards-compatibility
|
||||
new GameAction("set background color", "Background Color")
|
||||
{
|
||||
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.ChangeBackgroundColor(e["colorA"], 0f); },
|
||||
@ -63,19 +76,9 @@ namespace HeavenStudio.Games.Loaders
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("colorA", Tambourine.defaultBGColor, "Background Color", "The background color to change to.")
|
||||
}
|
||||
},
|
||||
hidden = true
|
||||
},
|
||||
new GameAction("fade background", "Fade Background Color")
|
||||
{
|
||||
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.FadeBackgroundColor(e["colorA"], e["colorB"], e.length); },
|
||||
defaultLength = 4f,
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("colorA", Color.white, "Start Color", "The starting color of the fade."),
|
||||
new Param("colorB", Tambourine.defaultBGColor, "End Color", "The ending color of the fade.")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -394,10 +397,10 @@ namespace HeavenStudio.Games
|
||||
}
|
||||
}
|
||||
|
||||
public void FadeBackgroundColor(Color start, Color end, float beats)
|
||||
public void FadeBackgroundColor(Color start, Color end, float beats, bool instant)
|
||||
{
|
||||
ChangeBackgroundColor(start, 0f);
|
||||
ChangeBackgroundColor(end, beats);
|
||||
if (!instant) ChangeBackgroundColor(end, beats);
|
||||
}
|
||||
|
||||
public void SummonFrog()
|
||||
|
Reference in New Issue
Block a user