Catch of the Day (#807)

* Freeze Frame

Hey, I'm about done with Freeze Frame and I'm just gonna commit the game as it is right now, it's almost done thx
-playinful

* Freeze Frame - finishing touches before finalized assets

Still waiting to implement the upscaled assets and the sound effects. Code-wise this is as much as I can do for now.

* i fixed a couple bugs

the dim screen is back and no input duplication when switching games. hallelujah

* FreezeFrame randomness update

hey AJ so i was cleaning my room when i was struck by an idea for how to make the randomization more consistent without seeding. *yes unfortunately* it requires a static variable but i promise u i used it responsibly.

* initial commit

* mar 13

* Updated cloud particles

* 3/22

* First PR

* corrected a mistake

* forgot to change that goofy ahh icon

---------

Co-authored-by: minenice55 <star.elementa@gmail.com>
This commit is contained in:
playinful
2024-03-28 22:35:11 -04:00
committed by GitHub
parent 642426751b
commit a0bec7acd0
226 changed files with 252526 additions and 27 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 10652e40863e5d7458033e4176f25ca6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,82 @@
using System.Collections;
using System.Collections.Generic;
using HeavenStudio;
using HeavenStudio.Games;
using HeavenStudio.Util;
using Jukebox;
using UnityEditor.Playables;
using UnityEngine;
using UnityEngine.Rendering;
namespace HeavenStudio.Games.Scripts_CatchOfTheDay
{
public class BGFish : MonoBehaviour
{
[SerializeField] Animator _Animator;
[SerializeField] SpriteRenderer _Sprite;
[SerializeField] FleeAnimation FleeAnim;
[SerializeField] bool FlipSprite;
private bool Out = false;
public void SetColor(Color color)
{
_Sprite.color = color;
}
public void Flee()
{
bool doFlip = transform.localScale.x < 0;// i hate this. it works
switch (FleeAnim)
{
case FleeAnimation.WestSouthWest:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_ESE" : "BGFishOut_WSW", 0.5f);
break;
case FleeAnimation.SouthWest:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_SE" : "BGFishOut_SW", 0.5f);
break;
case FleeAnimation.WestNorthWest:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_ENE" : "BGFishOut_WNW", 0.5f);
break;
case FleeAnimation.NorthWest:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_NE" : "BGFishOut_NW", 0.5f);
break;
case FleeAnimation.West:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_E" : "BGFishOut_W", 0.5f);
break;
case FleeAnimation.EastSouthEast:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_WSW" : "BGFishOut_ESE", 0.5f);
break;
case FleeAnimation.SouthEast:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_SW" : "BGFishOut_SE", 0.5f);
break;
case FleeAnimation.EastNorthEast:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_WNW" : "BGFishOut_ENE", 0.5f);
break;
case FleeAnimation.NorthEast:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_NW" : "BGFishOut_NE", 0.5f);
break;
case FleeAnimation.East:
default:
_Animator.DoScaledAnimationAsync(doFlip ? "BGFishOut_W" : "BGFishOut_E", 0.5f);
break;
}
Out = true;
}
public enum FleeAnimation : int
{
East = 0,
EastSouthEast = 1,
SouthEast = 2,
EastNorthEast = 3,
NorthEast = 4,
West = 8,
WestSouthWest = 9,
SouthWest = 10,
WestNorthWest = 11,
NorthWest = 12,
}
}
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0aa7b17762738384287534bd5ca0457f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,345 @@
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using HeavenStudio.InputSystem;
using Jukebox;
using System.Runtime.CompilerServices;
using HeavenStudio.Games.Scripts_CatchOfTheDay;
using UnityEngine.AI;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
public static class RvlCatchOfTheDayLoader
{
public static Minigame AddGame(EventCaller eventCaller)
{
return new Minigame("catchOfTheDay", "Catch of the Day", "b5dede", false, false, new List<GameAction>()
{
new GameAction("fish1", "Quicknibble")
{
function = delegate {var e = eventCaller.currentEntity; CatchOfTheDay.Cue_Fish01(e); CatchOfTheDay.Instance.NewLake(e); },
inactiveFunction = delegate {var e = eventCaller.currentEntity; CatchOfTheDay.Cue_Fish01(e); },
defaultLength = 3f,
parameters = new List<Param>()
{
new Param("layout", CatchOfTheDay.FishLayout.Random, "Layout", "Set the layout for the scene."),
new Param("useCustomColor", false, "Custom Color", "Set whether or not to use a custom color.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "colorTop", "colorBottom" })
}),
new Param("colorTop", new Color(0.7098039f, 0.8705882f, 0.8705882f), "Top Color", "The color for the top part of the background."),
new Param("colorBottom", new Color(0.4666667f, 0.7372549f, 0.8196079f), "Bottom Color", "The color for the bottom part of the background."),
new Param("sceneDelay", new EntityTypes.Float(0f, 32f, 1f), "Scene Change Delay", "Amount of beats to wait before changing to the next scene."),
new Param("fgManta", false, "Foreground Stingray", "Spawn a stingray in the foreground of the scene."),
new Param("bgManta", false, "Background Stingray", "Spawn a stingray in the background of the scene."),
new Param("schoolFish", false, "School of Fish", "Spawn a school of fish to as a distraction.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "fishDensity" })
}),
new Param("fishDensity", new EntityTypes.Float(0f, 1f, 1f), "Fish Density", "Set the density for the fish in the school."),
},
},
new GameAction("fish2", "Pausegill")
{
function = delegate {var e = eventCaller.currentEntity; CatchOfTheDay.Cue_Fish02(e); CatchOfTheDay.Instance.NewLake(e); },
inactiveFunction = delegate {var e = eventCaller.currentEntity; CatchOfTheDay.Cue_Fish02(e); },
defaultLength = 4f,
parameters = new List<Param>()
{
new Param("countIn", false, "Count-In", "Play the \"And Go!\" sound effect as a count in to the cue."),
new Param("layout", CatchOfTheDay.FishLayout.Random, "Layout", "Set the layout for the scene."),
new Param("useCustomColor", false, "Custom Color", "Set whether or not to use a custom color.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "colorTop", "colorBottom" })
}),
new Param("colorTop", new Color(0.7098039f, 0.8705882f, 0.8705882f), "Top Color", "The color for the top part of the background."),
new Param("colorBottom", new Color(0.4666667f, 0.7372549f, 0.8196079f), "Bottom Color", "The color for the bottom part of the background."),
new Param("sceneDelay", new EntityTypes.Float(0f, 32f, 1f), "Scene Change Delay", "Amount of beats to wait before changing to the next scene."),
new Param("fgManta", false, "Foreground Stingray", "Spawn a stingray in the foreground of the scene."),
new Param("bgManta", false, "Background Stingray", "Spawn a stingray in the background of the scene."),
new Param("schoolFish", false, "School of Fish", "Spawn a school of fish to as a distraction.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "fishDensity" })
}),
new Param("fishDensity", new EntityTypes.Float(0f, 1f, 1f), "Fish Density", "Set the density for the fish in the school."),
},
},
new GameAction("fish3", "Threefish")
{
function = delegate {var e = eventCaller.currentEntity; CatchOfTheDay.Cue_Fish03(e); CatchOfTheDay.Instance.NewLake(e); },
inactiveFunction = delegate {var e = eventCaller.currentEntity; CatchOfTheDay.Cue_Fish03(e); },
defaultLength = 5.5f,
parameters = new List<Param>()
{
new Param("countIn", false, "Count-In", "Play the \"One Two Three Go!\" sound effect as a count in to the cue."),
new Param("fakeOut", false, "Fake-Out", "If enabled, a quicknibble will be shown initially, before being chased away by the threefish."),
new Param("layout", CatchOfTheDay.FishLayout.Random, "Layout", "Set the layout for the scene."),
new Param("useCustomColor", false, "Custom Color", "Set whether or not to use a custom color.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "colorTop", "colorBottom" })
}),
new Param("colorTop", new Color(0.7098039f, 0.8705882f, 0.8705882f), "Top Color", "The color for the top part of the background."),
new Param("colorBottom", new Color(0.4666667f, 0.7372549f, 0.8196079f), "Bottom Color", "The color for the bottom part of the background."),
new Param("sceneDelay", new EntityTypes.Float(0f, 32f, 1f), "Scene Change Delay", "Amount of beats to wait before changing to the next scene."),
new Param("fgManta", false, "Foreground Stingray", "Spawn a stingray in the foreground of the scene."),
new Param("bgManta", false, "Background Stingray", "Spawn a stingray in the background of the scene."),
new Param("schoolFish", false, "School of Fish", "Spawn a school of fish to as a distraction.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "fishDensity" })
}),
new Param("fishDensity", new EntityTypes.Float(0f, 1f, 1f), "Fish Density", "Set the density for the fish in the school."),
},
},
},
new List<string>() {"rvl", "normal"},
"rvlfishing", "en"
//, chronologicalSortIndex: 21
);
}
}
}
namespace HeavenStudio.Games
{
public class CatchOfTheDay : Minigame
{
/*
BIG LIST OF TODOS
- ping @hexiedecimal
- scene transitions
- wait for upscale
- make ann movable
*/
public static CatchOfTheDay Instance
{
get
{
if (GameManager.instance.minigame is CatchOfTheDay instance)
return instance;
return null;
}
}
[SerializeField] Animator Angler;
[SerializeField] GameObject LakeScenePrefab;
[SerializeField] Transform LakeSceneHolder;
public int? LastLayout;
public Dictionary<RiqEntity, LakeScene> ActiveLakes = new();
public static Dictionary<RiqEntity, MultiSound> FishSounds = new();
private void Update()
{
if (!conductor.isPlaying && !conductor.isPaused && ActiveLakes.Count <= 0)
{
List<RiqEntity> activeFishes = GetActiveFishes(conductor.songPositionInBeatsAsDouble);
if (activeFishes.Count > 0)
NewLake(activeFishes[0]);
else
SpawnNextFish(conductor.songPositionInBeatsAsDouble);
}
}
public override void OnPlay(double beat)
{
OnGameSwitch(beat);
}
public override void OnGameSwitch(double beat)
{
DestroyOrphanedLakes();
CleanupFishSounds();
// get active fishes
foreach (RiqEntity e in GetActiveFishes(beat))
{
NewLake(e);
}
if (ActiveLakes.Count <= 0)
{
SpawnNextFish(beat);
}
}
public static void Cue_Fish01(RiqEntity e)
{
CleanupFishSounds();
double beat = e.beat;
FishSounds.Add(e, MultiSound.Play(new MultiSound.Sound[]{
new MultiSound.Sound("catchOfTheDay/quick1", beat),
new MultiSound.Sound("catchOfTheDay/quick2", beat + 1),
}, forcePlay: true));
if (Instance != null && Instance.ActiveLakes.ContainsKey(e))
Instance.ActiveLakes[e]._MultiSound = FishSounds[e];
}
public static void Cue_Fish02(RiqEntity e)
{
CleanupFishSounds();
double beat = e.beat;
bool countIn = e["countIn"];
FishSounds.Add(e, MultiSound.Play(new MultiSound.Sound[]{
new MultiSound.Sound("catchOfTheDay/pausegill1", beat),
new MultiSound.Sound("catchOfTheDay/pausegill2", beat + 0.5),
new MultiSound.Sound("catchOfTheDay/pausegill3", beat + 1),
}, forcePlay: true));
if (countIn)
{
MultiSound.Play(new MultiSound.Sound[]{
new MultiSound.Sound("count-ins/and", beat + 2),
new MultiSound.Sound(UnityEngine.Random.Range(0.0f, 1.0f) > 0.5 ? "count-ins/go1" : "count-ins/go2", beat + 2),
}, forcePlay: true, game: false);
}
if (Instance != null && Instance.ActiveLakes.ContainsKey(e))
Instance.ActiveLakes[e]._MultiSound = FishSounds[e];
}
public static void Cue_Fish03(RiqEntity e)
{
CleanupFishSounds();
double beat = e.beat;
bool countIn = e["countIn"];
FishSounds.Add(e, MultiSound.Play(new MultiSound.Sound[]{
new MultiSound.Sound("catchOfTheDay/threefish1", beat),
new MultiSound.Sound("catchOfTheDay/threefish2", beat + 0.25),
new MultiSound.Sound("catchOfTheDay/threefish3", beat + 0.5),
new MultiSound.Sound("catchOfTheDay/threefish4", beat + 1)
}, forcePlay: true));
if (countIn)
{
MultiSound.Play(new MultiSound.Sound[]{
new MultiSound.Sound("count-ins/one1", beat + 2),
new MultiSound.Sound("count-ins/two1", beat + 3),
new MultiSound.Sound("count-ins/three1", beat + 4),
new MultiSound.Sound(UnityEngine.Random.Range(0.0f, 1.0f) > 0.5 ? "count-ins/go1" : "count-ins/go2", beat + 4.5),
}, forcePlay: true, game: false);
}
if (Instance != null && Instance.ActiveLakes.ContainsKey(e))
Instance.ActiveLakes[e]._MultiSound = FishSounds[e];
}
public void DoPickAnim()
{
Angler.DoScaledAnimationAsync("Pick", 0.5f);
}
public void DoJustAnim()
{
Angler.DoScaledAnimationAsync("Just", 0.5f);
}
public void DoMissAnim()
{
Angler.DoScaledAnimationAsync("Miss", 0.5f);
}
public void DoThroughAnim()
{
Angler.DoScaledAnimationAsync("Through", 0.5f);
}
public void DoOutAnim()
{
Angler.DoScaledAnimationAsync("Through", 0.5f);
}
public void DestroyOrphanedLakes()
{
List<GameObject> toDestroy = new();
for (int i = 0; i < LakeSceneHolder.childCount; i++)
{
LakeScene lake = LakeSceneHolder.GetChild(i).gameObject.GetComponent<LakeScene>();
if (lake == null || (!ActiveLakes.ContainsValue(lake) && !lake.IsDummy))
toDestroy.Add(LakeSceneHolder.GetChild(i).gameObject);
}
foreach (GameObject obj in toDestroy)
{
Destroy(obj);
}
}
public static void CleanupFishSounds()
{
List<RiqEntity> expiredKeys = new();
foreach (KeyValuePair<RiqEntity, MultiSound> kv in FishSounds)
{
if (kv.Value == null)
expiredKeys.Add(kv.Key);
}
foreach (RiqEntity key in expiredKeys)
FishSounds.Remove(key);
}
public List<RiqEntity> GetActiveFishes(double beat)
{
return EventCaller.GetAllInGameManagerList("catchOfTheDay", new string[] { "fish1", "fish2", "fish3" }).FindAll(e => e.beat <= beat && e.beat + e.length - 1 + e["sceneDelay"] >= beat);
}
public RiqEntity GetNextFish(double beat)
{
RiqEntity gameSwitch = GetNextGameSwitch(beat);
return EventCaller.GetAllInGameManagerList("catchOfTheDay", new string[] { "fish1", "fish2", "fish3" }).OrderBy(e => e.beat).FirstOrDefault(e => e.beat >= beat && (gameSwitch is null || e.beat < gameSwitch.beat));
}
public RiqEntity GetNextGameSwitch(double beat)
{
return EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" }).OrderBy(e => e.beat).FirstOrDefault(e => e.beat > beat && e.datamodel != "gameManager/switchGame/catchOfTheDay");
}
public LakeScene NewLake(RiqEntity e)
{
if (ActiveLakes.ContainsKey(e))
return null;
int sort = EventCaller.GetAllInGameManagerList("catchOfTheDay", new string[] { "fish1", "fish2", "fish3" }).FindIndex(x => e == x);
if (sort < 0)
return null;
CleanupFishSounds();
LakeScene lake = Instantiate(LakeScenePrefab, LakeSceneHolder).GetComponent<LakeScene>();
LastLayout = lake.Setup(e, this, LastLayout, int.MaxValue - sort);
ActiveLakes.Add(e, lake);
if (FishSounds.ContainsKey(e))
lake._MultiSound = FishSounds[e];
return lake;
}
public bool SpawnNextFish(double beat)
{
RiqEntity nextFish = GetNextFish(beat);
if (nextFish is not null)
{
NewLake(nextFish);
return true;
}
return false;
}
public void DisposeLake(LakeScene lake)
{
ActiveLakes.Remove(lake.Entity);
if (ActiveLakes.Count <= 0)
{
if (SpawnNextFish(conductor.songPositionInBeatsAsDouble))
Destroy(lake.gameObject);
}
else
Destroy(lake.gameObject);
}
public enum FishLayout : int
{
Random = -1,
LayoutA = 0,
LayoutB = 1,
LayoutC = 2
}
}
}
// This minigame ported by playinful. ☆

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be95505827d715c46b24b45dcd238053
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,395 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using HeavenStudio;
using HeavenStudio.Games;
using HeavenStudio.Util;
using Jukebox;
using UnityEditor.Playables;
using UnityEngine;
using UnityEngine.Rendering;
namespace HeavenStudio.Games.Scripts_CatchOfTheDay
{
public class LakeScene : MonoBehaviour
{
[SerializeField] public bool IsDummy = false;
[SerializeField] public Animator FishAnimator;
[SerializeField] public Animator BGAnimator;
[SerializeField] public SpriteRenderer GradientBG;
[SerializeField] public SpriteRenderer TopBG;
[SerializeField] public SpriteRenderer BottomBG;
[SerializeField] public BGFish[] BGFishes;
[SerializeField] public SortingGroup _SortingGroup;
[SerializeField] public GameObject BigManta;
[SerializeField] public GameObject SmallManta;
[SerializeField] public GameObject FishSchool;
[SerializeField] public GameObject[] SchoolFishes;
[SerializeField] public ParticleSystem[] Bubbles;
[SerializeField] Color[] TopColors;
[SerializeField] Color[] BottomColors;
public RiqEntity Entity;
public PlayerActionEvent ReelAction;
public CatchOfTheDay Minigame;
public bool FishOut = false;
public MultiSound _MultiSound;
void Update()
{
if (FishSchool.activeSelf)
FishSchool.transform.localEulerAngles = new Vector3(0, 0, Conductor.instance.songPositionInBeats * 45);
if (BigManta.activeSelf)
BigManta.transform.localPosition = new Vector3((float)Entity.beat - Conductor.instance.songPositionInBeats + 4.5f, BigManta.transform.localPosition.y, BigManta.transform.localPosition.z);
if (SmallManta.activeSelf)
SmallManta.transform.localPosition = new Vector3(1.25f + ((Conductor.instance.songPositionInBeats - (float)Entity.beat) * 0.13f), SmallManta.transform.localPosition.y, SmallManta.transform.localPosition.y);
}
public int Setup(RiqEntity e, CatchOfTheDay minigame, int? lastLayout = null, int sortingIndex = 0)
{
Entity = e;
Minigame = minigame;
switch (e.datamodel)
{
case "catchOfTheDay/fish1":
FishAnimator.DoScaledAnimationAsync("Fish1_Wait", 0.5f);
BeatAction.New(this, new List<BeatAction.Action>()
{
new BeatAction.Action(e.beat, delegate { ReelAction = minigame.ScheduleInput(e.beat, 2f, CatchOfTheDay.InputAction_BasicPress, Hit, Through, Out); }),
new BeatAction.Action(e.beat, delegate { DoPickAnim(e.beat); }),
new BeatAction.Action(e.beat + 1, delegate { DoPickAnim(e.beat + 1); }),
new BeatAction.Action(e.beat + 2 - 0.1f, delegate { DoBiteAnim(e.beat + 2 - 0.1f); }),
new BeatAction.Action(e.beat + 2 + (float)e["sceneDelay"], delegate { minigame.DisposeLake(this); }),
});
break;
case "catchOfTheDay/fish2":
FishAnimator.DoScaledAnimationAsync("Fish2_Wait", 0.5f);
BeatAction.New(this, new List<BeatAction.Action>()
{
new BeatAction.Action(e.beat, delegate { ReelAction = minigame.ScheduleInput(e.beat, 3f, CatchOfTheDay.InputAction_BasicPress, Hit, Through, Out); }),
new BeatAction.Action(e.beat, delegate { DoPickAnim(e.beat); }),
new BeatAction.Action(e.beat + 0.5f, delegate { DoPickAnim(e.beat + 0.5f); }),
new BeatAction.Action(e.beat + 1, delegate { DoPickAnim(e.beat + 1); }),
new BeatAction.Action(e.beat + 3 - 0.1f, delegate { DoBiteAnim(e.beat + 3 - 0.1f); }),
new BeatAction.Action(e.beat + 3 + (float)e["sceneDelay"], delegate { minigame.DisposeLake(this); }),
});
break;
case "catchOfTheDay/fish3":
List<BeatAction.Action> beatActions = new();
if ((bool)e["fakeOut"])
{
FishAnimator.DoScaledAnimationAsync("Fish1_Wait", 0.5f);
beatActions.Add(new BeatAction.Action(e.beat - 4, delegate { FishAnimator.DoScaledAnimationFromBeatAsync("Fish3_WaitB", timeScale: 0.5f, startBeat: e.beat - 4); }));
}
else
FishAnimator.DoScaledAnimationAsync("Fish3_Wait", 0.5f);
beatActions.AddRange(new List<BeatAction.Action>(){
new BeatAction.Action(e.beat, delegate { ReelAction = minigame.ScheduleInput(e.beat, 4.5f, CatchOfTheDay.InputAction_BasicPress, Hit, Through, Out); }),
new BeatAction.Action(e.beat, delegate { DoPickAnim(e.beat); }),
new BeatAction.Action(e.beat + 0.25f, delegate { DoPickAnim(e.beat + 0.25f, down: true); }),
new BeatAction.Action(e.beat + 0.5f, delegate { DoPickAnim(e.beat + 0.5f); }),
new BeatAction.Action(e.beat + 1f, delegate { DoPickAnim(e.beat + 1f, down: true); }),
new BeatAction.Action(e.beat + 4.5f - 0.1f, delegate { DoBiteAnim(e.beat + 4.5f - 0.1f); }),
new BeatAction.Action(e.beat + + (float)e["sceneDelay"], delegate { minigame.DisposeLake(this); }),
});
BeatAction.New(this, beatActions);
break;
default:
break;
}
int layout = e["layout"];
if (layout == (int)CatchOfTheDay.FishLayout.Random)
{
if (lastLayout is int ll)
{
List<int> layouts = new() { 0, 1, 2 };
layouts.Remove(ll);
layout = layouts[UnityEngine.Random.Range(0, layouts.Count)];
}
else
layout = 0;
}
switch (layout)
{
case (int)CatchOfTheDay.FishLayout.LayoutC:
BGAnimator.DoScaledAnimationAsync("LayoutC", 0.5f);
break;
case (int)CatchOfTheDay.FishLayout.LayoutB:
BGAnimator.DoScaledAnimationAsync("LayoutB", 0.5f);
break;
case (int)CatchOfTheDay.FishLayout.LayoutA:
default:
BGAnimator.DoScaledAnimationAsync("LayoutA", 0.5f);
break;
}
if (e["useCustomColor"])
{
SetBGColors(e["colorTop"], e["colorBottom"]);
}
else
{
SetBGColors(TopColors[layout], BottomColors[layout]);
}
_SortingGroup.sortingOrder = sortingIndex;
float xOffset = UnityEngine.Random.Range(-0.5f, 0.5f);
float yOffset = UnityEngine.Random.Range(-0.3f, 0.3f);
transform.position += new Vector3(xOffset, yOffset, 0);
if ((bool)e["schoolFish"])
{
FishSchool.SetActive(true);
SetFishDensity(e["fishDensity"]);
}
else
FishSchool.SetActive(false);
BigManta.SetActive(e["fgManta"]);
SmallManta.SetActive(e["bgManta"]);
int bubbleCount = UnityEngine.Random.Range(0, 4);
foreach (ParticleSystem particle in Bubbles.OrderBy(_ => UnityEngine.Random.Range(0.0f, 1.0f)).ToArray()[0..bubbleCount])
particle.PlayScaledAsync(0.5f);
return layout; // returning this so we can catalogue the most recent layout so we don't double up
}
public void SetBGColors(Color topColor, Color bottomColor)
{
GradientBG.color = topColor;
TopBG.color = topColor;
BottomBG.color = bottomColor;
foreach (BGFish fish in BGFishes)
{
fish.SetColor(bottomColor);
}
}
public void SetFishDensity(float density)
{
if (density <= 0.0f)
{
FishSchool.SetActive(false);
return;
}
float fishCount = density * SchoolFishes.Length;
for (int i = 0; i < SchoolFishes.Length; i++)
{
SchoolFishes[i].SetActive(i < fishCount);
}
}
public void Hit(PlayerActionEvent caller, float state)
{
if (FishOut)
return;
if (state is < 1 and > (-1))
{
Just();
}
else
{
Miss();
}
}
public void Just()
{
if (FishOut)
return;
switch (Entity.datamodel)
{
case "catchOfTheDay/fish1":
FishAnimator.DoScaledAnimationAsync("Fish1_Just", 0.5f);
SoundByte.PlayOneShotGame("catchOfTheDay/quick3");
break;
case "catchOfTheDay/fish2":
FishAnimator.DoScaledAnimationAsync("Fish2_Just", 0.5f);
SoundByte.PlayOneShotGame("catchOfTheDay/pausegill4");
break;
case "catchOfTheDay/fish3":
FishAnimator.DoScaledAnimationAsync("Fish3_Just", 0.5f);
SoundByte.PlayOneShotGame("catchOfTheDay/threefish5");
break;
default:
break;
}
Minigame.DoJustAnim();
}
public void Miss()
{
if (FishOut)
return;
FishOut = true;
switch (Entity.datamodel)
{
case "catchOfTheDay/fish1":
FishAnimator.DoScaledAnimationAsync("Fish1_Miss", 0.5f);
break;
case "catchOfTheDay/fish2":
FishAnimator.DoScaledAnimationAsync("Fish2_Miss", 0.5f);
break;
case "catchOfTheDay/fish3":
FishAnimator.DoScaledAnimationAsync("Fish3_Miss", 0.5f);
break;
default:
break;
}
Minigame.DoMissAnim();
SoundByte.PlayOneShotGame("catchOfTheDay/nearMiss");
}
public void Through(PlayerActionEvent caller)
{
if (FishOut)
return;
switch (Entity.datamodel)
{
case "catchOfTheDay/fish1":
FishAnimator.DoScaledAnimationAsync("Fish1_Through", 0.5f);
SoundByte.PlayOneShotGame("catchOfTheDay/quick_laugh");
break;
case "catchOfTheDay/fish2":
FishAnimator.DoScaledAnimationAsync("Fish2_Through", 0.5f);
SoundByte.PlayOneShotGame("catchOfTheDay/pausegill_laugh");
break;
case "catchOfTheDay/fish3":
FishAnimator.DoScaledAnimationAsync("Fish3_Through", 0.5f);
SoundByte.PlayOneShotGame("catchOfTheDay/threefish_laugh");
break;
default:
break;
}
Minigame.DoThroughAnim();
}
public void Out(PlayerActionEvent caller)
{
if (FishOut)
return;
FishOut = true;
Minigame.ScoreMiss();
switch (Entity.datamodel)
{
case "catchOfTheDay/fish1":
FishAnimator.DoScaledAnimationAsync("Fish1_Out", 0.5f);
break;
case "catchOfTheDay/fish2":
FishAnimator.DoScaledAnimationAsync("Fish2_Out", 0.5f);
break;
case "catchOfTheDay/fish3":
FishAnimator.DoScaledAnimationAsync("Fish3_Out", 0.5f);
break;
default:
break;
}
Minigame.DoOutAnim();
_MultiSound.StopAll();
ReelAction.CanHit(false);
if (UnityEngine.Random.Range(0.0f, 1.0f) > 0.75)
{
foreach (BGFish fish in BGFishes)
{
fish.Flee();
}
}
SoundByte.PlayOneShot("miss");
}
public void DoPickAnim(double beat, bool down = false)
{
if (FishOut)
return;
switch (Entity.datamodel)
{
case "catchOfTheDay/fish1":
FishAnimator.DoScaledAnimationFromBeatAsync("Fish1_Pick", 0.5f, beat);
break;
case "catchOfTheDay/fish2":
FishAnimator.DoScaledAnimationFromBeatAsync("Fish2_Pick", 0.5f, beat);
break;
case "catchOfTheDay/fish3":
if (down)
FishAnimator.DoScaledAnimationFromBeatAsync("Fish3_PickDown", 0.5f, beat);
else
FishAnimator.DoScaledAnimationFromBeatAsync("Fish3_PickUp", 0.5f, beat);
break;
default:
break;
}
Minigame.DoPickAnim();
}
public void DoBiteAnim(double beat)
{
if (FishOut)
return;
switch (Entity.datamodel)
{
case "catchOfTheDay/fish1":
FishAnimator.DoScaledAnimationFromBeatAsync("Fish1_Bite", 0.5f, beat);
break;
case "catchOfTheDay/fish2":
FishAnimator.DoScaledAnimationFromBeatAsync("Fish2_Bite", 0.5f, beat);
break;
case "catchOfTheDay/fish3":
FishAnimator.DoScaledAnimationFromBeatAsync("Fish3_Bite", 0.5f, beat);
break;
default:
break;
}
}
[SerializeField] GameObject SchoolFishPrefab;
[ContextMenu("Spawn a bunch of fish")]
void SpawnABunchOfFish()
{
Transform container = transform.Find("FishSchool");
List<Transform> toDestroy = new();
for (int i = 0; i < container.childCount; i++)
{
toDestroy.Add(container.GetChild(i));
}
foreach (Transform child in toDestroy)
DestroyImmediate(child.gameObject);
SchoolFishes = new GameObject[250];
for (int i = 1; i <= 250; i++)
{
var randRot = UnityEngine.Random.Range(-180f, 180f);
container.eulerAngles = new Vector3(0, 0, randRot);
GameObject fish = Instantiate(SchoolFishPrefab, container);
fish.name = $"SchoolFish{i:D2}";
var yOffset = UnityEngine.Random.Range(3f, 11f);
fish.transform.position += new Vector3(0, yOffset, 0);
fish.transform.eulerAngles -= new Vector3(0, 0, randRot + 180);
SchoolFishes[i-1] = fish;
}
container.eulerAngles = Vector3.zero;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f97884e1d9b26444992770441a9e7dae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -93,6 +93,16 @@ namespace HeavenStudio
Debug.LogWarning("Game loader PcoCanneryLoader failed!");
}
game = RvlCatchOfTheDayLoader.AddGame(eventCaller);
if (game != null)
{
eventCaller.minigames.Add(game.name, game);
}
else
{
Debug.LogWarning("Game loader RvlCatchOfTheDayLoader failed!");
}
game = CtrCatchLoader.AddGame(eventCaller);
if (game != null)
{
@ -122,6 +132,16 @@ namespace HeavenStudio
{
Debug.LogWarning("Game loader RvlBookLoader failed!");
}
game = NtrFreezeFrameLoader.AddGame(eventCaller);
if (game != null)
{
eventCaller.minigames.Add(game.name, game);
}
else
{
Debug.LogWarning("Game loader NtrCameraManLoader failed!");
}
game = AgbClapLoader.AddGame(eventCaller);
if (game != null)

View File

@ -106,5 +106,13 @@ namespace HeavenStudio.Util
}
Destroy(gameObject);
}
public void StopAll()
{
foreach (Util.Sound sound in playingSounds)
{
sound.Stop();
}
}
}
}