HeavenStudioPlus/Assets/Scripts/Games/Ringside/Ringside.cs
Rapandrasmus dd24a96338 Title Screen (#454)
* Barebones title screen prefab added

* logo and stuff

* cool

* Added sfx to title screen

* The logo now bops to the beat

* epic reveal

* Fixed something

* put some of the stuff into the main menu

* other logo bop

* Implemented logobop2 and starbop

* added scrolling bg, tweaked positioning and wip splash text for play button

* more menu

* ooops

* Expand implemented

* cool

* Made stars spawn in in the opening

* make UI elements look nicer on different aspect ratios

* add sound while hovering over logo

* add settings menu to title screen

make the title screen properly play after the opening

* swap out title screen hover sound

remove the old config path warning

* every button works, some play mode fixes

* fix issues with beataction/multisound and pausing

* fix dropdown menus not working in certain screens

* fix particles rotating when camera controls are used

* touch style pause menu items only trigger if cursor is over an item

* various changes

make playback (unpausing) more reliable
only apply changes to advanced audio settings on launch
fix title screen visuals
add opening music
continue past opening by pressing a key
update credits

* almost forgot this

* lol

* initial flow mems

* user-taggable fonts in textboxes

* alt materials for kurokane

* assets prep

* plan out judgement screen layout

change sound encodings

* start sequencing judgement

* judgement screen sequence

* full game loop

* fix major issue with pooled sound objects

rebalance ranking audio
fix issues with some effects in play mode

* new graphics

* particles

* make certain uses of the beat never go below 0

fix loop of superb music

* make markers non clamped

lockstep frees rendertextures when unloading

* lockstep creates its own rendertextures

swapped button order on title screen
added null checks to animation helpers
disabled controller auto-search for now

* enable particles on OK rank

* play mode info panel

* let play mode handle its own fade out

* fix that alignment bug in controller settings

* more safety here

* Update PauseMenu.cs

* settable (one-liner) rating screen text

* address minigame loading crashes

* don't do this twice

* wav converter for mp3

* Update Minigames.cs

* don't double-embed the converted audio

* studio dance bugfixing spree

* import redone sprites for studio dance

* update jukebox

prep epilogue screen

* epilogue screen

* studio dance inkling shuffle test

* new studio dance choreo system

* markers upgrade

* fix deleting volume changes and markers

prep category markers

* Update Editor.unity

* new rating / epilogue settings look

* update to use new tooltip system

mark certain editor components as blocking

* finish category system

* dedicated tempo / volume marker dialogs

* swing prep

* open properties dialog if mapper hasn't opened it prior for this chart

fix memory copy bug when making new chart

* fix ctrl + s

* return to title screen button

* make graphy work everywhere

studio dance selector
membillion mems

* make sure riq cache is clear when loading chart

* lol

* fix the stupid

* bring back tempo and volume change scrolling

* new look for panels

* adjust alignment

* round tooltip

* alignment of chart property prefab

* change scale factor of mem

* adjust open captions material

no dotted BG in results commentary (only epilogue)
bugfix for tempo / volume scroll

* format line 2 of judgement a bit better

update font

* oops

* adjust look of judgement score bar

* new rating bar

* judgement size adjustment

* fix timing window scaling with song pitch

* proper clamping in dialogs

better sync conductor to dsptime (experiment)

* disable timeline pitch change when song is paused

enable perfect challenge if no marker is set to do so

* new app icon

* timing window values are actually double now

* improve deferred timekeep even more

* re-generate font atlases

new app icon in credits

* default epilogue images

* more timing window adjustment

* fix timing display when pitched

* use proper terminology here

* new logo on titlescreen

* remove wip from play

update credits

* adjust spacing of play mode panel

* redo button spacing

* can pass title screen with any controller

fix issues with controller auto-search

* button scale fixes

* controller title screen nav

* remove song genre from properties editor

* disable circle cursor when not using touch style

* proper selection graphic

remove refs
re-add heart to the opening

* controller support in opening

---------

Co-authored-by: ev <85412919+evdial@users.noreply.github.com>
Co-authored-by: minenice55 <star.elementa@gmail.com>
Co-authored-by: ThatZeoMan <67521686+ThatZeoMan@users.noreply.github.com>
2023-12-26 05:22:51 +00:00

936 lines
42 KiB
C#

using HeavenStudio.Util;
using HeavenStudio.InputSystem;
using System;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
public static class RvlRingsideLoader
{
public static Minigame AddGame(EventCaller eventCaller)
{
return new Minigame("ringside", "Ringside", "6bdfe7", false, false, new List<GameAction>()
{
new GameAction("question", "Question")
{
function = delegate {var e = eventCaller.currentEntity; Ringside.instance.Question(e.beat, e["alt"], e["variant"]); },
parameters = new List<Param>()
{
new Param("alt", false, "Alt", "Whether the alt voice line should be used or not."),
new Param("variant", Ringside.QuestionVariant.Random, "Variant", "Which variant of the cue do you wish to play.")
},
defaultLength = 4f
},
new GameAction("woahYouGoBigGuy", "Woah You Go Big Guy!")
{
function = delegate {var e = eventCaller.currentEntity; Ringside.instance.BigGuy(e.beat, e["variant"]); },
parameters = new List<Param>()
{
new Param("variant", Ringside.QuestionVariant.Random, "Variant", "Which variant of the cue do you wish to play.")
},
defaultLength = 4f
},
new GameAction("poseForTheFans", "Pose For The Fans!")
{
preFunction = delegate {var e = eventCaller.currentEntity; Ringside.PoseForTheFans(e.beat, e["and"], e["variant"], e["keepZoomedOut"], e["newspaperBeats"]); },
parameters = new List<Param>()
{
new Param("and", false, "And", "Whether the And voice line should be said or not."),
new Param("variant", Ringside.PoseForTheFansVariant.Random, "Variant", "Which variant of the cue do you wish to play."),
new Param("keepZoomedOut", false, "Keep Zoomed Out", "Whether the camera should keep being zoomed out after the event has completed."),
new Param("newspaperBeats", new EntityTypes.Float(0, 80, 0), "Newspaper Beats", "How many beats should the newspaper stay for?"),
new Param("ease", Util.EasingFunction.Ease.EaseOutQuad, "Camera Ease", "What ease should the camera use?"),
},
defaultLength = 4f
},
new GameAction("toggleBop", "Bop")
{
function = delegate {var e = eventCaller.currentEntity; Ringside.instance.ToggleBop(e.beat, e.length, e["bop2"], e["bop"]); },
parameters = new List<Param>()
{
new Param("bop2", true, "Bop?", "Whether the wrestler should bop or not."),
new Param("bop", false, "Bop? (Auto)", "Whether the wrestler should bop automatically or not."),
},
resizable = true,
},
new GameAction("toggleSweat", "Toggle Sweat")
{
function = delegate {var e = eventCaller.currentEntity; Ringside.instance.ToggleSweat(e["sweat"]); },
parameters = new List<Param>()
{
new Param("sweat", false, "Sweat?", "Whether the wrestler should sweat or not."),
},
defaultLength = 0.5f
},
new GameAction("questionScaled", "Question (Stretchable)")
{
function = delegate {var e = eventCaller.currentEntity; Ringside.instance.Question(e.beat, e["alt"], e["variant"], e.length); },
preFunction = delegate {if (Ringside.instance == null) return; var e = eventCaller.currentEntity; Ringside.instance.PreQuestion(e.beat, e["variant"], e.length); },
parameters = new List<Param>()
{
new Param("alt", false, "Alt", "Whether the alt voice line should be used or not."),
new Param("variant", Ringside.QuestionVariant.Random, "Variant", "Which variant of the cue do you wish to play.")
},
defaultLength = 4f,
resizable = true
},
},
new List<string>() {"rvl", "normal"},
"rvlinterview", "en",
new List<string>() {"en"}
);
}
}
}
namespace HeavenStudio.Games
{
public class Ringside : Minigame
{
private static Color _defaultBGColorLight;
public static Color defaultBGColorLight
{
get
{
ColorUtility.TryParseHtmlString("#5a5a5a", out _defaultBGColorLight);
return _defaultBGColorLight;
}
}
[Header("Components")]
[SerializeField] Animator wrestlerAnim;
[SerializeField] Animator reporterAnim;
[SerializeField] Animator reporterHeadAnim;
[SerializeField] Animator audienceAnim;
[SerializeField] Animator wrestlerNewspaperAnim;
[SerializeField] Animator reporterNewspaperAnim;
[SerializeField] SpriteRenderer flashWhite;
[SerializeField] SpriteRenderer blackVoid;
[SerializeField] GameObject flashObject;
[SerializeField] GameObject poseFlash;
[SerializeField] GameObject newspaper;
[SerializeField] Transform wrestlerTransform;
[SerializeField] SpriteRenderer bg;
[SerializeField] ParticleSystem flashParticles;
[SerializeField] ParticleSystem sweatParticles;
[Header("Variables")]
public static List<QueuedPose> queuedPoses = new List<QueuedPose>();
public struct QueuedPose
{
public double beat;
public bool keepZoomedOut;
public float newspaperBeats;
}
Tween flashTween;
Tween bgTween;
public enum QuestionVariant
{
First = 1,
Second = 2,
Third = 3,
Random = 4,
}
public enum PoseForTheFansVariant
{
First = 1,
Second = 2,
Random = 3
}
private float currentZoomCamBeat;
private Vector3 lastCamPos = new Vector3(0, 0, -10);
private Vector3 currentCamPos = new Vector3(0, 0, -10);
private bool missedBigGuy;
private bool reporterShouldHeart;
private bool hitPose;
private bool shouldNotInput;
private bool keepZoomOut;
private bool canBop = true;
private Sound kidsLaugh;
private int currentPose;
private Util.EasingFunction.Ease lastEase;
private GameObject currentNewspaper;
private int currentZoomIndex;
private List<RiqEntity> allCameraEvents = new List<RiqEntity>();
public GameEvent bop = new GameEvent();
public static Ringside instance;
const int IAAltDownCat = IAMAXCAT;
protected static bool IA_PadAltPress(out double dt)
{
return PlayerInput.GetPadDown(InputController.ActionsPad.South, out dt);
}
protected static bool IA_BatonAltPress(out double dt)
{
return PlayerInput.GetSqueezeDown(out dt);
}
protected static bool IA_TouchAltPress(out double dt)
{
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
&& instance.IsExpectingInputNow(InputAction_Alt);
}
public static PlayerInput.InputAction InputAction_Alt =
new("RvlInterviewAlt", new int[] { IAAltDownCat, IAAltDownCat, IAAltDownCat },
IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress);
void OnDestroy()
{
if (queuedPoses.Count > 0) queuedPoses.Clear();
SoundByte.KillLoop(kidsLaugh, 2f);
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
}
public override void OnTimeChange()
{
UpdateCameraZoom();
}
void Awake()
{
instance = this;
SetupBopRegion("ringside", "toggleBop", "bop");
var camEvents = EventCaller.GetAllInGameManagerList("ringside", new string[] { "poseForTheFans" });
List<RiqEntity> tempEvents = new List<RiqEntity>();
for (int i = 0; i < camEvents.Count; i++)
{
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
{
tempEvents.Add(camEvents[i]);
}
}
allCameraEvents = tempEvents;
UpdateCameraZoom();
wrestlerAnim.Play("Idle", 0, 1);
ReporterBlink();
}
public override void OnBeatPulse(double beat)
{
if (BeatIsInBopRegion(beat) && canBop)
{
if (UnityEngine.Random.Range(1, 18) == 1)
{
wrestlerAnim.DoScaledAnimationAsync("BopPec");
}
else
{
wrestlerAnim.DoScaledAnimationAsync("Bop");
}
}
}
private bool canDoMissExpression()
{
return (reporterHeadAnim.IsPlayingAnimationNames(new string[] { "BlinkHead", "ExtendBlink", "ExcitedBlink", "Idle", "ExtendIdle", "Excited", "Miss", "Late" }) || reporterHeadAnim.IsAnimationNotPlaying()) && !reporterHeadAnim.GetCurrentAnimatorStateInfo(0).IsName("Flinch");
}
void Update()
{
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused)
{
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress) && !shouldNotInput)
{
if ((PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch)
|| (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch && !IsExpectingInputNow(InputAction_Alt)))
{
Ringside.instance.ScoreMiss(0.5f);
wrestlerAnim.DoScaledAnimationAsync("YeMiss", 0.25f);
SoundByte.PlayOneShotGame($"ringside/confusedanswer");
if (canDoMissExpression()) reporterHeadAnim.DoScaledAnimationAsync("Miss", 0.5f);
}
}
if ( PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch
&& PlayerInput.GetIsAction(InputAction_FlickPress) && !IsExpectingInputNow(InputAction_FlickPress) && !shouldNotInput)
{
Ringside.instance.ScoreMiss(0.5f);
SoundByte.PlayOneShotGame($"ringside/muscles2");
wrestlerAnim.DoScaledAnimationAsync("BigGuyTwo", 0.5f);
if (canDoMissExpression()) reporterAnim.Play("FlinchReporter", 0, 0);
if (canDoMissExpression()) reporterHeadAnim.Play("Flinch", 0, 0);
SoundByte.PlayOneShotGame("ringside/barely");
}
if (PlayerInput.GetIsAction(InputAction_Alt) && !IsExpectingInputNow(InputAction_Alt) && !shouldNotInput)
{
Ringside.instance.ScoreMiss(0.5f);
int randomPose = UnityEngine.Random.Range(1, 7);
wrestlerAnim.Play($"Pose{randomPose}", 0, 0);
if (canDoMissExpression()) reporterAnim.Play("FlinchReporter", 0, 0);
if (canDoMissExpression()) reporterHeadAnim.Play("Flinch", 0, 0);
SoundByte.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw");
wrestlerTransform.localScale = new Vector3(1.1f, 1.1f, 1f);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(cond.songPositionInBeatsAsDouble + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }),
});
}
}
if (allCameraEvents.Count > 0)
{
if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0)
{
if (Conductor.instance.songPositionInBeatsAsDouble >= allCameraEvents[currentZoomIndex].beat)
{
UpdateCameraZoom();
currentZoomIndex++;
}
}
float normalizedBeat = Conductor.instance.GetPositionFromBeat(currentZoomCamBeat, 2.5f);
float normalizedShouldStopBeat = Conductor.instance.GetPositionFromBeat(currentZoomCamBeat, 3.99f);
if (normalizedBeat >= 0)
{
if (normalizedShouldStopBeat > 1 && !keepZoomOut)
{
GameCamera.AdditionalPosition = new Vector3(0, 0, 0);
}
else if (normalizedBeat > 1)
{
GameCamera.AdditionalPosition = new Vector3(currentCamPos.x, currentCamPos.y, currentCamPos.z + 10);
}
else
{
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
float newPosX = func(lastCamPos.x, currentCamPos.x, normalizedBeat);
float newPosY = func(lastCamPos.y, currentCamPos.y, normalizedBeat);
float newPosZ = func(lastCamPos.z + 10, currentCamPos.z + 10, normalizedBeat);
GameCamera.AdditionalPosition = new Vector3(newPosX, newPosY, newPosZ);
}
}
}
}
void LateUpdate()
{
var cond = Conductor.instance;
if (cond.isPlaying && !cond.isPaused)
{
if (queuedPoses.Count > 0)
{
foreach (var p in queuedPoses)
{
QueuePose(p.beat, p.keepZoomedOut, p.newspaperBeats);
}
queuedPoses.Clear();
}
}
}
public void ToggleBop(double beat, float length, bool startBopping, bool autoBop)
{
if (startBopping)
{
for (int i = 0; i < length; i++)
{
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + i, delegate
{
if (wrestlerAnim.IsAnimationNotPlaying())
{
if (UnityEngine.Random.Range(1, 18) == 1)
{
wrestlerAnim.DoScaledAnimationAsync("BopPec");
}
else
{
wrestlerAnim.DoScaledAnimationAsync("Bop");
}
}
})
});
}
}
}
public void ToggleSweat(bool shouldSweat)
{
if (shouldSweat)
{
sweatParticles.Play();
}
else
{
sweatParticles.Stop();
}
}
public void Question(double beat, bool alt, int questionVariant, float length = 4f)
{
if (length <= 2f) return;
int currentQuestion = questionVariant;
if (currentQuestion == (int)QuestionVariant.Random) currentQuestion = UnityEngine.Random.Range(1, 4);
reporterAnim.DoScaledAnimationAsync("WubbaLubbaDubbaThatTrue", 0.4f);
reporterHeadAnim.DoScaledAnimationAsync("Wubba", 0.4f);
List<MultiSound.Sound> qSounds = new List<MultiSound.Sound>();
if (alt)
{
qSounds.Add(new MultiSound.Sound($"ringside/wub{currentQuestion}", beat));
}
else
{
qSounds.Add(new MultiSound.Sound($"ringside/wubba{currentQuestion}-1", beat));
qSounds.Add(new MultiSound.Sound($"ringside/wubba{currentQuestion}-2", beat + 0.25f));
}
float extend = length - 3f;
int totalExtend = 0;
if (extend > 0f)
{
for (int i = 0; i < extend; i++)
{
qSounds.Add(new MultiSound.Sound($"ringside/dubba{currentQuestion}-1", beat + i + 0.5f ));
qSounds.Add(new MultiSound.Sound($"ringside/dubba{currentQuestion}-2", beat + i + 0.75f ));
qSounds.Add(new MultiSound.Sound($"ringside/dubba{currentQuestion}-3", beat + i + 1f ));
qSounds.Add(new MultiSound.Sound($"ringside/dubba{currentQuestion}-4", beat + i + 1.25f ));
totalExtend++;
}
}
MultiSound.Play(qSounds.ToArray(), forcePlay: true);
ThatTrue(beat + totalExtend, currentQuestion);
}
public void PreQuestion(double beat, int questionVariant, float length = 4f)
{
if (GameManager.instance.currentGame != "ringside") return;
if (instance == null) return;
if (length <= 2f)
{
int currentQuestion = questionVariant;
if (currentQuestion == (int)QuestionVariant.Random) currentQuestion = UnityEngine.Random.Range(1, 4);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat - 0.5f, delegate { reporterAnim.DoScaledAnimationAsync("WubbaLubbaDubbaThatTrue", 0.4f); reporterHeadAnim.DoScaledAnimationAsync("Wubba", 0.4f); }),
});
ThatTrue(beat - 1, currentQuestion);
}
}
public void ThatTrue(double beat, int currentQuestion)
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound($"ringside/that{currentQuestion}", beat + 0.5f),
new MultiSound.Sound($"ringside/true{currentQuestion}", beat + 1f),
}, forcePlay: true);
ScheduleInput(beat, 2f, InputAction_BasicPress, JustQuestion, Miss, Nothing);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 0.5f, delegate { reporterAnim.DoScaledAnimationAsync("ThatTrue", 0.5f); reporterHeadAnim.DoScaledAnimationAsync("IsThat", 0.5f); }),
new BeatAction.Action(beat + 1.5f, delegate { canBop = false; }),
new BeatAction.Action(beat + 2.5f, delegate { canBop = true; })
});
}
public void BigGuy(double beat, int questionVariant)
{
int currentQuestion = questionVariant;
if (currentQuestion == (int)QuestionVariant.Random) currentQuestion = UnityEngine.Random.Range(1, 4);
reporterAnim.DoScaledAnimationAsync("Woah", 0.5f);
reporterHeadAnim.DoScaledAnimationAsync("Woah", 0.5f);
float youBeat = 0.65f;
if (currentQuestion == (int)QuestionVariant.Third) youBeat = 0.7f;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound($"ringside/woah{currentQuestion}", beat),
new MultiSound.Sound($"ringside/you{currentQuestion}", beat + youBeat),
new MultiSound.Sound($"ringside/go{currentQuestion}", beat + 1f),
new MultiSound.Sound($"ringside/big{currentQuestion}", beat + 1.5f),
new MultiSound.Sound($"ringside/guy{currentQuestion}", beat + 2f),
}, forcePlay: true);
ScheduleInput(beat, 2.5f, InputAction_BasicPress, JustBigGuyFirst, MissBigGuyOne, Nothing);
ScheduleInput(beat, 3f, InputAction_FlickPress, JustBigGuySecond, MissBigGuyTwo, Nothing);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate { reporterAnim.Play("True", 0, 0); reporterHeadAnim.Play("Extend", 0, 0); }),
new BeatAction.Action(beat + 2.25f, delegate { canBop = false; }),
new BeatAction.Action(beat + 3.5f, delegate { canBop = true; })
});
}
public static void PoseForTheFans(double beat, bool and, int variant, bool keepZoomedOut, float newspaperBeats)
{
if (and)
{
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("ringside/poseAnd", beat - 0.5f),
}, forcePlay: true);
}
int poseLine = variant;
if (poseLine == 3) poseLine = UnityEngine.Random.Range(1, 3);
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound($"ringside/pose{poseLine}", beat),
new MultiSound.Sound($"ringside/for{poseLine}", beat + 0.5f),
new MultiSound.Sound($"ringside/the{poseLine}", beat + 0.75f),
new MultiSound.Sound($"ringside/fans{poseLine}", beat + 1f),
}, forcePlay: true);
if (GameManager.instance.currentGame == "ringside")
{
Ringside.instance.QueuePose(beat, keepZoomedOut, newspaperBeats);
}
else
{
queuedPoses.Add(new QueuedPose { beat = beat, keepZoomedOut = keepZoomedOut, newspaperBeats = newspaperBeats});
}
}
public void QueuePose(double beat, bool keepZoomedOut, float newspaperBeats)
{
if (newspaperBeats > 0)
{
reporterShouldHeart = true;
}
else
{
reporterShouldHeart = false;
}
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate
{
audienceAnim.DoScaledAnimationAsync("PoseAudience", 0.25f);
wrestlerAnim.DoScaledAnimationAsync("PreparePose", 0.25f);
canBop = false;
}),
new BeatAction.Action(beat + 1, delegate { PoseCheck(beat); }),
new BeatAction.Action(beat + 4f, delegate
{
if (BeatIsInBopRegion(beat + 4f))
{
if (UnityEngine.Random.Range(1, 18) == 1)
{
wrestlerAnim.DoScaledAnimationAsync("BopPec");
}
else
{
wrestlerAnim.DoScaledAnimationAsync("Bop");
}
}
else wrestlerAnim.Play("Idle", 0, 1);
shouldNotInput = false;
canBop = true;
reporterAnim.Play("IdleReporter", 0, 0);
if (reporterHeadAnim.IsAnimationNotPlaying()) reporterHeadAnim.Play("Idle", 0, 0);
}),
});
if (!keepZoomedOut)
{
if (newspaperBeats > 0)
{
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 3f, delegate
{
keepZoomOut = true;
blackVoid.color = Color.black;
GameObject spawnedNewsPaper = Instantiate(newspaper, transform);
spawnedNewsPaper.SetActive(true);
currentNewspaper = spawnedNewsPaper;
wrestlerNewspaperAnim = spawnedNewsPaper.transform.GetChild(1).GetComponent<Animator>();
reporterNewspaperAnim = spawnedNewsPaper.transform.GetChild(2).GetComponent<Animator>();
if (UnityEngine.Random.Range(1, 3) == 1)
{
spawnedNewsPaper.GetComponent<Animator>().Play("NewspaperEnter", 0, 0);
}
else
{
spawnedNewsPaper.GetComponent<Animator>().Play("NewspaperEnterRight", 0, 0);
}
if (!hitPose)
{
wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
kidsLaugh = SoundByte.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
}
else
{
wrestlerNewspaperAnim.Play($"Pose{currentPose}Newspaper", 0, 0);
reporterNewspaperAnim.Play("HeartReporterNewspaper", 0, 0);
hitPose = true;
}
}),
new BeatAction.Action(beat + 3f + newspaperBeats, delegate
{
blackVoid.color = new Color(1f, 1f, 1f, 0);
Destroy(currentNewspaper); currentNewspaper = null;
lastCamPos = new Vector3(0, 0, -10);
SoundByte.KillLoop(kidsLaugh, 0.25f);
keepZoomOut = false;
})
});
}
else
{
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 3.99f, delegate
{
lastCamPos = new Vector3(0, 0, -10);
keepZoomOut = false;
}),
});
}
}
else
{
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2.5f, delegate
{
lastCamPos = currentCamPos;
keepZoomOut = true;
})
});
if (newspaperBeats > 0)
{
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 3f, delegate
{
blackVoid.color = Color.black;
GameObject spawnedNewsPaper = Instantiate(newspaper, transform);
spawnedNewsPaper.SetActive(true);
currentNewspaper = spawnedNewsPaper;
wrestlerNewspaperAnim = spawnedNewsPaper.transform.GetChild(1).GetComponent<Animator>();
reporterNewspaperAnim = spawnedNewsPaper.transform.GetChild(2).GetComponent<Animator>();
if (UnityEngine.Random.Range(1, 3) == 1)
{
spawnedNewsPaper.GetComponent<Animator>().Play("NewspaperEnter", 0, 0);
}
else
{
spawnedNewsPaper.GetComponent<Animator>().Play("NewspaperEnterRight", 0, 0);
}
if (!hitPose)
{
wrestlerNewspaperAnim.Play($"Miss{UnityEngine.Random.Range(1, 7)}Newspaper", 0, 0);
reporterNewspaperAnim.Play("IdleReporterNewspaper", 0, 0);
kidsLaugh = SoundByte.PlayOneShotGame("ringside/kidslaugh", -1, 1, 1, true);
}
else
{
wrestlerNewspaperAnim.Play($"Pose{currentPose}Newspaper", 0, 0);
reporterNewspaperAnim.Play("HeartReporterNewspaper", 0, 0);
hitPose = true;
}
}),
new BeatAction.Action(beat + 3f + newspaperBeats, delegate
{
blackVoid.color = new Color(1f, 1f, 1f, 0);
Destroy(currentNewspaper); currentNewspaper = null;
SoundByte.KillLoop(kidsLaugh, 0.25f);
})
});
}
}
}
private void UpdateCameraZoom()
{
if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0)
{
currentZoomCamBeat = (float)allCameraEvents[currentZoomIndex].beat;
currentCamPos = new Vector3(poseFlash.transform.position.x, poseFlash.transform.position.y, -21.5f);
lastEase = (Util.EasingFunction.Ease)allCameraEvents[currentZoomIndex]["ease"];
}
}
public void PoseCheck(double beat)
{
ScheduleInput(beat, 2f, InputAction_Alt, JustPoseForTheFans, MissPose, Nothing);
}
public void ChangeFlashColor(Color color, float beats)
{
var seconds = Conductor.instance.secPerBeat * beats;
if (flashTween != null)
flashTween.Kill(true);
if (seconds == 0)
{
flashWhite.color = color;
}
else
{
flashTween = flashWhite.DOColor(color, seconds);
}
}
public void FadeFlashColor(Color start, Color end, float beats)
{
ChangeFlashColor(start, 0f);
ChangeFlashColor(end, beats);
}
public void ChangeBGColor(Color color, float beats)
{
var seconds = Conductor.instance.secPerBeat * beats;
if (bgTween != null)
bgTween.Kill(true);
if (seconds == 0)
{
bg.color = color;
}
else
{
flashTween = bg.DOColor(color, seconds);
}
}
public void FadeBGColor(Color start, Color end, float beats)
{
ChangeBGColor(start, 0f);
ChangeBGColor(end, beats);
}
public void ReporterBlink()
{
if (reporterHeadAnim.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
{
reporterHeadAnim.DoScaledAnimationAsync("BlinkHead", 0.5f);
}
else if (reporterHeadAnim.GetCurrentAnimatorStateInfo(0).IsName("ExtendIdle"))
{
reporterHeadAnim.DoScaledAnimationAsync("ExtendBlink", 0.5f);
}
else if (reporterHeadAnim.GetCurrentAnimatorStateInfo(0).IsName("Excited"))
{
reporterHeadAnim.DoScaledAnimationAsync("ExcitedBlink", 0.5f);
}
float randomTime = UnityEngine.Random.Range(0.3f, 1.8f);
Invoke("ReporterBlink", randomTime);
}
public void JustQuestion(PlayerActionEvent caller, float state)
{
if (state >= 1f || state <= -1f)
{
wrestlerAnim.DoScaledAnimationAsync("Cough", 0.5f);
SoundByte.PlayOneShotGame($"ringside/cough");
reporterHeadAnim.DoScaledAnimationAsync("Late", 0.5f);
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { reporterAnim.Play("IdleReporter", 0, 0); if (reporterHeadAnim.IsAnimationNotPlaying()) reporterHeadAnim.Play("Idle", 0, 0); }),
});
return;
}
SuccessQuestion(caller);
}
public void SuccessQuestion(PlayerActionEvent caller)
{
wrestlerAnim.DoScaledAnimationAsync("Ye", 0.5f);
reporterHeadAnim.Play("ExtendSmile", 0, 0);
SoundByte.PlayOneShotGame($"ringside/ye{UnityEngine.Random.Range(1, 4)}");
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate
{
SoundByte.PlayOneShotGame("ringside/yeCamera");
FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 0.5f);
flashObject.SetActive(true);
reporterAnim.Play("IdleReporter", 0, 0);
reporterHeadAnim.Play("Smile", 0, 0);
}),
new BeatAction.Action(caller.startBeat + caller.timer + 0.6f, delegate { flashObject.SetActive(false); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { if (reporterHeadAnim.IsAnimationNotPlaying()) reporterHeadAnim.Play("Idle", 0, 0); }),
});
}
public void JustBigGuyFirst(PlayerActionEvent caller, float state)
{
if (state >= 1f || state <= -1f)
{
missedBigGuy = true;
SoundByte.PlayOneShotGame($"ringside/muscles1");
wrestlerAnim.DoScaledAnimationAsync("BigGuyOne", 0.5f);
return;
}
SuccessBigGuyFirst();
}
public void SuccessBigGuyFirst()
{
missedBigGuy = false;
SoundByte.PlayOneShotGame($"ringside/muscles1");
wrestlerAnim.DoScaledAnimationAsync("BigGuyOne", 0.5f);
}
public void JustBigGuySecond(PlayerActionEvent caller, float state)
{
if (state >= 1f || state <= -1f)
{
SoundByte.PlayOneShotGame($"ringside/muscles2");
wrestlerAnim.DoScaledAnimationAsync("BigGuyTwo", 0.5f);
if (!missedBigGuy)
{
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleReporter", 0, 0); }),
});
}
else
{
reporterHeadAnim.Play("Late", 0, 0);
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleReporter", 0, 0); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { if (reporterHeadAnim.IsAnimationNotPlaying()) reporterHeadAnim.Play("Idle", 0, 0); }),
});
}
return;
}
SuccessBigGuySecond(caller);
}
public void SuccessBigGuySecond(PlayerActionEvent caller)
{
SoundByte.PlayOneShotGame($"ringside/muscles2");
wrestlerAnim.DoScaledAnimationAsync("BigGuyTwo", 0.5f);
if (!missedBigGuy)
{
reporterHeadAnim.Play("ExtendSmile", 0, 0);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate
{
SoundByte.PlayOneShotGame("ringside/musclesCamera");
reporterAnim.Play("IdleReporter", 0, 0);
reporterHeadAnim.Play("Smile", 0, 0);
FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 0.5f);
flashObject.SetActive(true);
}),
new BeatAction.Action(caller.startBeat + caller.timer + 0.6f, delegate { flashObject.SetActive(false); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { if (reporterHeadAnim.IsAnimationNotPlaying()) reporterHeadAnim.Play("Idle", 0, 0); }),
});
}
else
{
reporterHeadAnim.Play("Miss", 0, 0);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleReporter", 0, 0); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { if (reporterHeadAnim.IsAnimationNotPlaying()) reporterHeadAnim.Play("Idle", 0, 0); }),
});
}
}
public void JustPoseForTheFans(PlayerActionEvent caller, float state)
{
shouldNotInput = true;
if (state >= 1f || state <= -1f)
{
wrestlerTransform.localScale = new Vector3(1.2f, 1.2f, 1f);
int randomPose = UnityEngine.Random.Range(1, 7);
wrestlerAnim.Play($"Pose{randomPose}", 0, 0);
SoundByte.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}Raw");
reporterHeadAnim.Play("Late", 0, 0);
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }),
});
return;
}
SuccessPoseForTheFans(caller);
}
public void SuccessPoseForTheFans(PlayerActionEvent caller)
{
wrestlerTransform.localScale = new Vector3(1.2f, 1.2f, 1f);
int randomPose = UnityEngine.Random.Range(1, 7);
currentPose = randomPose;
wrestlerAnim.Play($"Pose{randomPose}", 0, 0);
if (reporterShouldHeart)
{
reporterAnim.Play("HeartReporter", 0, 0);
reporterHeadAnim.Play("Heart", 0, 0);
}
else
{
reporterAnim.Play("ExcitedReporter", 0, 0);
reporterHeadAnim.Play("Excited", 0, 0);
}
hitPose = true;
SoundByte.PlayOneShotGame($"ringside/yell{UnityEngine.Random.Range(1, 7)}");
FadeFlashColor(Color.white, new Color(1, 1, 1, 0), 1f);
FadeBGColor(Color.black, defaultBGColorLight, 1f);
flashParticles.Play();
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.1f, delegate { wrestlerTransform.localScale = new Vector3(1f, 1f, 1f); }),
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { SoundByte.PlayOneShotGame("ringside/poseCamera"); }),
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { flashParticles.Stop(); }),
new BeatAction.Action(caller.startBeat + caller.timer + 1f, delegate { poseFlash.SetActive(true); poseFlash.GetComponent<Animator>().Play("PoseFlashing", 0, 0); }),
new BeatAction.Action(caller.startBeat + caller.timer + 1.99f, delegate { poseFlash.SetActive(false); }),
});
}
public void Miss(PlayerActionEvent caller)
{
reporterHeadAnim.Play("Late", 0, 0);
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleReporter", 0, 0); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { reporterHeadAnim.Play("Idle", 0, 0); }),
});
}
public void MissBigGuyOne(PlayerActionEvent caller)
{
missedBigGuy = true;
}
public void MissBigGuyTwo(PlayerActionEvent caller)
{
reporterHeadAnim.Play("Late", 0, 0);
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5f, delegate { reporterAnim.Play("IdleReporter", 0, 0); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { reporterHeadAnim.Play("Idle", 0, 0); }),
new BeatAction.Action(caller.startBeat + caller.timer + 0.9f, delegate { wrestlerAnim.Play("Idle", 0, 0); }),
});
}
public void MissPose(PlayerActionEvent caller)
{
shouldNotInput = true;
reporterHeadAnim.Play("Late", 0, 0);
SoundByte.PlayOneShotGame($"ringside/huhaudience{UnityEngine.Random.Range(0, 2)}");
}
public void Nothing(PlayerActionEvent caller){}
}
}