Catch of the Day (bugfixes) (#814)

* 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

* Bugfixes

Fixed a bug where fishes could be reeled in before the bite animation played and get stuck in the bite animation.
Fixed a bug where the count-in for the pausegill played at the incorrect time.
Fixed a bug where the threefish would cause a scene transition at the incorrect time.

* Crossfade close to done

* The Long Awaited Crossfade Update

* added sort key

* one last quick bugfix (hopefully)

---------

Co-authored-by: minenice55 <star.elementa@gmail.com>
This commit is contained in:
playinful 2024-04-04 21:28:01 -04:00 committed by GitHub
parent 80ae5eaf6b
commit 75e248c97b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 58576 additions and 56674 deletions

View file

@ -18,7 +18,7 @@
-<indent=5%>Bhaos</indent>
-<indent=5%>RaffyTaffy14</indent>
-<indent=5%>Thinedave</indent>
-<indent=5%>playinful</indent>
-<indent=5%>Yin</indent>
-<indent=5%>Marc / ThePurpleAnon</indent>
-<indent=5%>fu_majime</indent>
-<indent=5%>Streitixy</indent>

File diff suppressed because it is too large Load diff

View file

@ -72,7 +72,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: -4
m_Sprite: {fileID: -1654869705, guid: 9dc0046d9c64c0845916b64d36e2fc7e, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@ -133,6 +133,7 @@ MonoBehaviour:
_Animator: {fileID: 1962400969548684622}
_Sprite: {fileID: 8334324854123224507}
FleeAnim: 0
FlipSprite: 0
--- !u!95 &1962400969548684622
Animator:
serializedVersion: 5

View file

@ -4781,7 +4781,7 @@ ParticleSystemRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: 600
m_RenderMode: 0
m_MeshDistribution: 0
m_SortMode: 0

File diff suppressed because it is too large Load diff

View file

@ -178,7 +178,6 @@ GameObject:
m_Component:
- component: {fileID: 6818461398746758092}
- component: {fileID: 7532825851267565565}
- component: {fileID: 8842803494614929758}
m_Layer: 0
m_Name: SchoolFish
m_TagString: Untagged
@ -225,17 +224,6 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!210 &8842803494614929758
SortingGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6469500009000541928}
m_Enabled: 1
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 500
--- !u!1 &8946698474682847267
GameObject:
m_ObjectHideFlags: 0

View file

@ -165,9 +165,9 @@ AnimatorStateTransition:
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -189,7 +189,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -264,7 +264,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -339,7 +339,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -414,7 +414,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -436,7 +436,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -458,7 +458,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -480,7 +480,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -634,7 +634,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -888,7 +888,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -1015,7 +1015,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -1035,9 +1035,9 @@ AnimatorStateTransition:
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.28571427
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -1111,7 +1111,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
@ -1346,7 +1346,7 @@ AnimatorStateTransition:
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0
m_ExitTime: 1
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0

View file

@ -4,6 +4,7 @@ using HeavenStudio;
using HeavenStudio.Games;
using HeavenStudio.Util;
using Jukebox;
using UnityEditor.Playables;
using UnityEngine;
using UnityEngine.Rendering;
@ -78,4 +79,4 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
NorthWest = 12,
}
}
}
}

View file

@ -1,17 +1,13 @@
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;
using HeavenStudio.Common;
namespace HeavenStudio.Games.Loaders
{
@ -25,8 +21,8 @@ namespace HeavenStudio.Games.Loaders
{
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); },
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>()
{
@ -37,7 +33,7 @@ namespace HeavenStudio.Games.Loaders
}),
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("sceneDelay", new EntityTypes.Float(0f, 32f, 2f), "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>()
@ -49,8 +45,8 @@ namespace HeavenStudio.Games.Loaders
},
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); },
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>()
{
@ -62,7 +58,7 @@ namespace HeavenStudio.Games.Loaders
}),
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("sceneDelay", new EntityTypes.Float(0f, 32f, 2f), "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>()
@ -74,8 +70,8 @@ namespace HeavenStudio.Games.Loaders
},
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); },
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>()
{
@ -88,7 +84,7 @@ namespace HeavenStudio.Games.Loaders
}),
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("sceneDelay", new EntityTypes.Float(0f, 32f, 2f), "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>()
@ -98,10 +94,54 @@ namespace HeavenStudio.Games.Loaders
new Param("fishDensity", new EntityTypes.Float(0f, 1f, 1f), "Fish Density", "Set the density for the fish in the school."),
},
},
new GameAction("moveAngler", "Move Angler")
{
function = delegate { var e = eventCaller.currentEntity; CatchOfTheDay.Instance.SetAnglerMovement(e); },
defaultLength = 1f,
resizable = true,
parameters = new List<Param>()
{
new Param("doMove", false, "Move", "Select this option if you want to move Ann.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "endMoveX", "endMoveY" } ),
new Param.CollapseParam((x, e) => (bool)x && (Util.EasingFunction.Ease)e["ease"] != Util.EasingFunction.Ease.Instant, new string[] { "startMoveX", "startMoveY" }),
new Param.CollapseParam((_, e) => (bool)e["doMove"] || (bool)e["doRotate"] || (bool)e["doScale"], new string[] { "ease" })
}),
new Param("startMoveX", new EntityTypes.Float(-20f, 20f, 0f), "Start X", "Set the X position from which to move."),
new Param("startMoveY", new EntityTypes.Float(-20f, 20f, 0f), "Start Y", "Set the Y position from which to move."),
new Param("endMoveX", new EntityTypes.Float(-20f, 20f, 0f), "End X", "Set the X position to which to move."),
new Param("endMoveY", new EntityTypes.Float(-20f, 20f, 0f), "End Y", "Set the Y position to which to move."),
new Param("doRotate", false, "Rotate", "Select this option if you want to rotate Ann.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "endRotDegrees" } ),
new Param.CollapseParam((x, e) => (bool)x && (Util.EasingFunction.Ease)e["ease"] != Util.EasingFunction.Ease.Instant, new string[] { "startRotDegrees" }),
new Param.CollapseParam((_, e) => (bool)e["doMove"] || (bool)e["doRotate"] || (bool)e["doScale"], new string[] { "ease" })
}),
new Param("startRotDegrees", new EntityTypes.Float(-360f, 360f, 0f), "Start Rotation", "Set the amount of degrees at which to begin rotating."),
new Param("endRotDegrees", new EntityTypes.Float(-360f, 360f, 0f), "End Rotation", "Set the amount of degrees at which to finish rotating."),
new Param("doScale", false, "Scale", "Select this option if you want to change Ann's scale.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "endScaleX", "endScaleY" } ),
new Param.CollapseParam((x, e) => (bool)x && (Util.EasingFunction.Ease)e["ease"] != Util.EasingFunction.Ease.Instant, new string[] { "startScaleX", "startScaleY" }),
new Param.CollapseParam((_, e) => (bool)e["doMove"] || (bool)e["doRotate"] || (bool)e["doScale"], new string[] { "ease" })
}),
new Param("startScaleX", new EntityTypes.Float(-5f, 5f, 1f), "Start Scale X", "Set the desired scale on the X axis at which to start."),
new Param("startScaleY", new EntityTypes.Float(-5f, 5f, 1f), "Start Scale Y", "Set the desired scale on the Y axis at which to start."),
new Param("endScaleX", new EntityTypes.Float(-5f, 5f, 1f), "End Scale X", "Set the desired scale on the X axis at which to end."),
new Param("endScaleY", new EntityTypes.Float(-5f, 5f, 1f), "End Scale Y", "Set the desired scale on the Y axis at which to end."),
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing for the action.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, e) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant && (bool)e["doMove"], new string[] { "startMoveX", "startMoveY" }),
new Param.CollapseParam((x, e) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant && (bool)e["doRotate"], new string[] { "startRotDegrees" }),
new Param.CollapseParam((x, e) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant && (bool)e["doScale"], new string[] { "startScaleX", "startScaleY" }),
}),
new Param("sticky", false, "Follow Camera", "Select this to make Ann follow the camera."),
}
}
},
new List<string>() {"rvl", "normal"},
"rvlfishing", "en"
//, chronologicalSortIndex: 21
, chronologicalSortKey: 21
);
}
}
@ -113,11 +153,10 @@ namespace HeavenStudio.Games
{
/*
BIG LIST OF TODOS
- ping @hexiedecimal
- scene transitions
- wait for upscale
- make ann movable
*/
protected const int MAX_LAKES = 50;
public static CatchOfTheDay Instance
{
get
@ -137,6 +176,28 @@ namespace HeavenStudio.Games
public static Dictionary<RiqEntity, MultiSound> FishSounds = new();
private List<RiqEntity> _AllFishes;
[SerializeField] Transform AnglerTransform;
private bool _AnglerIsMoving = false;
private AnglerMoveArgs _CurrentAnglerMoveArgs;
private bool _AnglerIsRotating = false;
private AnglerRotateArgs _CurrentAnglerRotateArgs;
private bool _AnglerIsScaling = false;
private AnglerScaleArgs _CurrentAnglerScaleArgs;
private Vector3 _AnglerBasePosition;
private Vector3 _AnglerBaseEulerAngles;
private Vector3 _AnglerBaseScale;
[SerializeField] StickyCanvas _StickyCanvas;
void Awake()
{
_AnglerBasePosition = AnglerTransform.localPosition;
_AnglerBaseEulerAngles = AnglerTransform.localEulerAngles;
_AnglerBaseScale = AnglerTransform.localScale;
}
private void Update()
{
if (!conductor.isPlaying && !conductor.isPaused && ActiveLakes.Count <= 0)
@ -147,6 +208,60 @@ namespace HeavenStudio.Games
else
SpawnNextFish(conductor.songPositionInBeatsAsDouble);
}
// Moving Ann
if (_AnglerIsMoving)
{
float normalizedBeat = Conductor.instance.GetPositionFromBeat(_CurrentAnglerMoveArgs.StartBeat, _CurrentAnglerMoveArgs.Length);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(_CurrentAnglerMoveArgs.Ease);
float newPos = func(0f, 1f, normalizedBeat);
Vector3 diff = _CurrentAnglerMoveArgs.EndPosition - _CurrentAnglerMoveArgs.StartPosition;
AnglerTransform.localPosition = _AnglerBasePosition + _CurrentAnglerMoveArgs.StartPosition + (diff * newPos);
if (normalizedBeat >= 1f)
{
AnglerTransform.localPosition = _AnglerBasePosition + _CurrentAnglerMoveArgs.EndPosition;
_AnglerIsMoving = false;
}
}
if (_AnglerIsRotating)
{
float normalizedBeat = Conductor.instance.GetPositionFromBeat(_CurrentAnglerRotateArgs.StartBeat, _CurrentAnglerRotateArgs.Length);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(_CurrentAnglerRotateArgs.Ease);
float newPos = func(0f, 1f, normalizedBeat);
float diff = _CurrentAnglerRotateArgs.EndRotation - _CurrentAnglerRotateArgs.StartRotation;
AnglerTransform.localEulerAngles = _AnglerBaseEulerAngles + new Vector3(0, 0, _CurrentAnglerRotateArgs.StartRotation + (diff * newPos));
if (normalizedBeat >= 1f)
{
AnglerTransform.localEulerAngles = _AnglerBaseEulerAngles + new Vector3(0, 0, _CurrentAnglerRotateArgs.EndRotation);
_AnglerIsRotating = false;
}
}
if (_AnglerIsScaling)
{
float normalizedBeat = Conductor.instance.GetPositionFromBeat(_CurrentAnglerScaleArgs.StartBeat, _CurrentAnglerScaleArgs.Length);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(_CurrentAnglerScaleArgs.Ease);
float newPos = func(0f, 1f, normalizedBeat);
Vector3 diff = _CurrentAnglerScaleArgs.EndScale - _CurrentAnglerScaleArgs.StartScale;
AnglerTransform.localScale = new Vector3
(
_AnglerBaseScale.x * (_CurrentAnglerScaleArgs.StartScale.x + (diff.x * newPos)),
_AnglerBaseScale.y * (_CurrentAnglerScaleArgs.StartScale.y + (diff.y * newPos)),
0
);
if (normalizedBeat >= 1f)
{
AnglerTransform.localScale = new Vector3
(
_AnglerBaseScale.x * _CurrentAnglerScaleArgs.EndScale.x,
_AnglerBaseScale.y * _CurrentAnglerScaleArgs.EndScale.y,
0
);
_AnglerIsScaling = false;
}
}
}
public override void OnPlay(double beat)
{
@ -156,6 +271,13 @@ namespace HeavenStudio.Games
{
DestroyOrphanedLakes();
CleanupFishSounds();
// set ann movement
foreach (RiqEntity e in EventCaller.GetAllInGameManagerList("catchOfTheDay", new string[] { "moveAngler" }).Where(e => e.beat <= beat).OrderBy(e => e.beat))
{
SetAnglerMovement(e);
}
// get active fishes
foreach (RiqEntity e in GetActiveFishes(beat))
{
@ -198,7 +320,7 @@ namespace HeavenStudio.Games
{
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),
new MultiSound.Sound(UnityEngine.Random.Range(0.0f, 1.0f) > 0.5 ? "count-ins/go1" : "count-ins/go2", beat + 3),
}, forcePlay: true, game: false);
}
@ -232,6 +354,41 @@ namespace HeavenStudio.Games
Instance.ActiveLakes[e]._MultiSound = FishSounds[e];
}
public void SetAnglerMovement(RiqEntity e)
{
if (e["doMove"])
{
_AnglerIsMoving = true;
_CurrentAnglerMoveArgs = new AnglerMoveArgs(
e.beat, e.length,
new Vector3(e["startMoveX"], e["startMoveY"], 0),
new Vector3(e["endMoveX"], e["endMoveY"], 0),
e["ease"]
);
}
if (e["doRotate"])
{
_AnglerIsRotating = true;
_CurrentAnglerRotateArgs = new AnglerRotateArgs(
e.beat, e.length,
e["startRotDegrees"],
e["endRotDegrees"],
e["ease"]
);
}
if (e["doScale"])
{
_AnglerIsScaling = true;
_CurrentAnglerScaleArgs = new AnglerScaleArgs(
e.beat, e.length,
new Vector3(e["startScaleX"], e["startScaleY"], 1),
new Vector3(e["endScaleX"], e["endScaleY"], 1),
e["ease"]
);
}
_StickyCanvas.Sticky = (bool)e["sticky"];
}
public void DoPickAnim()
{
Angler.DoScaledAnimationAsync("Pick", 0.5f);
@ -280,30 +437,36 @@ namespace HeavenStudio.Games
}
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);
return CacheFishes().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));
return CacheFishes().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 (ActiveLakes.Count >= MAX_LAKES)
return null;
int sort = CacheFishes().FindIndex(x => e == x);
if (sort < 0)
return null;
CleanupFishSounds();
Debug.Log($"Spawning Lake {sort}");
LakeScene lake = Instantiate(LakeScenePrefab, LakeSceneHolder).GetComponent<LakeScene>();
LastLayout = lake.Setup(e, this, LastLayout, int.MaxValue - sort);
LastLayout = lake.Setup(e, this, LastLayout, 0 - sort);
ActiveLakes.Add(e, lake);
if (FishSounds.ContainsKey(e))
lake._MultiSound = FishSounds[e];
@ -319,17 +482,22 @@ namespace HeavenStudio.Games
}
return false;
}
public void DisposeLake(LakeScene lake)
public void DisposeLake(LakeScene lake, double beat)
{
ActiveLakes.Remove(lake.Entity);
if (ActiveLakes.Count <= 0)
{
if (SpawnNextFish(conductor.songPositionInBeatsAsDouble))
Destroy(lake.gameObject);
lake.Crossfade(beat);
}
else
Destroy(lake.gameObject);
lake.Crossfade(beat);
}
public List<RiqEntity> CacheFishes()
{
return _AllFishes ??= EventCaller.GetAllInGameManagerList("catchOfTheDay", new string[] { "fish1", "fish2", "fish3" }).OrderBy(e => e.beat).ToList();
}
public enum FishLayout : int
@ -339,7 +507,59 @@ namespace HeavenStudio.Games
LayoutB = 1,
LayoutC = 2
}
private struct AnglerMoveArgs
{
public Vector3 StartPosition;
public Vector3 EndPosition;
public double StartBeat;
public double Length;
public Util.EasingFunction.Ease Ease;
public AnglerMoveArgs(double startBeat, double length, Vector3 startPosition, Vector3 endPosition, int ease)
{
StartPosition = startPosition;
EndPosition = endPosition;
StartBeat = startBeat;
Length = length;
Ease = (Util.EasingFunction.Ease)ease;
}
}
private struct AnglerRotateArgs
{
public float StartRotation;
public float EndRotation;
public double StartBeat;
public double Length;
public Util.EasingFunction.Ease Ease;
public AnglerRotateArgs(double startBeat, double length, float startRotation, float endRotation, int ease)
{
StartRotation = startRotation;
EndRotation = endRotation;
StartBeat = startBeat;
Length = length;
Ease = (Util.EasingFunction.Ease)ease;
}
}
private struct AnglerScaleArgs
{
public Vector3 StartScale;
public Vector3 EndScale;
public double StartBeat;
public double Length;
public Util.EasingFunction.Ease Ease;
public AnglerScaleArgs(double startBeat, double length, Vector3 startScale, Vector3 endScale, int ease)
{
StartScale = startScale;
EndScale = endScale;
StartBeat = startBeat;
Length = length;
Ease = (Util.EasingFunction.Ease)ease;
}
}
}
}
// This minigame ported by playinful. ☆
// This minigame ported by Yin. ☆

View file

@ -1,8 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using HeavenStudio;
using HeavenStudio.Games;
using HeavenStudio.Util;
using Jukebox;
using UnityEngine;
@ -11,7 +8,7 @@ using UnityEngine.Rendering;
namespace HeavenStudio.Games.Scripts_CatchOfTheDay
{
public class LakeScene : MonoBehaviour
{
{
[SerializeField] public bool IsDummy = false;
[SerializeField] public Animator FishAnimator;
@ -37,6 +34,15 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
public MultiSound _MultiSound;
private RenderTexture _RenderTexture;
private Texture2D _DisplayTexture;
private double? _CrossfadeStartBeat;
[SerializeField] GameObject Renderer;
private bool _FirstUpdate = false;
[SerializeField] Animator CrossfadeAnimator;
void Update()
{
if (FishSchool.activeSelf)
@ -45,6 +51,23 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
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);
if (!IsDummy)
RenderScene();
if (_CrossfadeStartBeat is double startBeat)
{
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1);
DisplaySprite.color = new Color(1, 1, 1, 1 - normalizedBeat);
float scale = 1 + (float)(normalizedBeat * 0.875);// * 2);
transform.localScale = new Vector3(scale, scale, 1);
if (normalizedBeat >= 1f) Destroy(gameObject);
}
}
void OnDestroy()
{
if (ReelAction != null)
ReelAction.Disable();
}
public int Setup(RiqEntity e, CatchOfTheDay minigame, int? lastLayout = null, int sortingIndex = 0)
@ -64,7 +87,7 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
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); }),
new BeatAction.Action(e.beat + 2 + (float)e["sceneDelay"], delegate { minigame.DisposeLake(this, e.beat + 2 + (float)e["sceneDelay"]); }),
});
break;
case "catchOfTheDay/fish2":
@ -78,7 +101,7 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
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); }),
new BeatAction.Action(e.beat + 3 + (float)e["sceneDelay"], delegate { minigame.DisposeLake(this, e.beat + 3 + (float)e["sceneDelay"]); }),
});
break;
case "catchOfTheDay/fish3":
@ -99,7 +122,7 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
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); }),
new BeatAction.Action(e.beat + 4.5f + (float)e["sceneDelay"], delegate { minigame.DisposeLake(this, e.beat + 4.5f + (float)e["sceneDelay"]); }),
});
BeatAction.New(this, beatActions);
break;
@ -142,11 +165,9 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
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);
Renderer.transform.position += new Vector3(xOffset, yOffset, 0);
if ((bool)e["schoolFish"])
{
@ -163,6 +184,10 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
foreach (ParticleSystem particle in Bubbles.OrderBy(_ => UnityEngine.Random.Range(0.0f, 1.0f)).ToArray()[0..bubbleCount])
particle.PlayScaledAsync(0.5f);
DisplaySprite.sortingOrder = sortingIndex;
Renderer.transform.localPosition -= new Vector3(0, 0, sortingIndex);
RenderCamera.transform.localPosition -= new Vector3(0, 0, sortingIndex);
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)
@ -227,6 +252,7 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
break;
}
Minigame.DoJustAnim();
FishOut = true;
}
public void Miss()
{
@ -251,6 +277,7 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
}
Minigame.DoMissAnim();
SoundByte.PlayOneShotGame("catchOfTheDay/nearMiss");
FishOut = true;
}
public void Through(PlayerActionEvent caller)
{
@ -358,11 +385,45 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
}
}
[SerializeField] Camera RenderCamera;
[SerializeField] SpriteRenderer DisplaySprite;
public void RenderScene()
{
if (!DisplaySprite.enabled)
return;
Rect rect = new Rect(0, 0, 1024, 1024);
if (_RenderTexture == null)
{
_RenderTexture = new RenderTexture(1024, 1024, 32);
RenderCamera.targetTexture = _RenderTexture;
_DisplayTexture = new Texture2D(1024, 1024, TextureFormat.RGBA32, false);
Sprite sprite = Sprite.Create(_DisplayTexture, new Rect(0, 0, 1024, 1024), new Vector2(0.5f, 0.5f));
DisplaySprite.sprite = sprite;
}
RenderCamera.Render();
RenderTexture currentRenderTexture = RenderTexture.active;
RenderTexture.active = _RenderTexture;
_DisplayTexture.ReadPixels(rect, 0, 0);
_DisplayTexture.Apply();
RenderTexture.active = currentRenderTexture;
}
public void Crossfade(double beat)
{
_CrossfadeStartBeat = beat;
//CrossfadeAnimator.DoScaledAnimationAsync("Crossfade", 0.5f);
}
[SerializeField] GameObject SchoolFishPrefab;
[ContextMenu("Spawn a bunch of fish")]
void SpawnABunchOfFish()
{
Transform container = transform.Find("FishSchool");
Transform container = transform.Find("Renderer/FishSchool");
List<Transform> toDestroy = new();
for (int i = 0; i < container.childCount; i++)
@ -379,7 +440,11 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
container.eulerAngles = new Vector3(0, 0, randRot);
GameObject fish = Instantiate(SchoolFishPrefab, container);
fish.name = $"SchoolFish{i:D2}";
fish.name = $"SchoolFish{i:D3}";
fish.transform.Find("Body").GetComponent<SpriteRenderer>().sortingOrder = i * 2;
fish.transform.Find("Fin").GetComponent<SpriteRenderer>().sortingOrder = (i * 2) + 1;
fish.transform.Find("Eye").GetComponent<SpriteRenderer>().sortingOrder = (i * 2) + 1;
var yOffset = UnityEngine.Random.Range(3f, 11f);
fish.transform.position += new Vector3(0, yOffset, 0);
@ -391,4 +456,4 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
}
}
}
}

View file

@ -374,7 +374,7 @@ namespace HeavenStudio
public uint? chronologicalSortKey;
// playinful: basically i figure this should just be whatever index number the minigame is
// Yin: basically i figure this should just be whatever index number the minigame is
// in its game of origin. So, basically, like, if we're talking Rhythm Heaven DS, Built to
// Scale would be 1, then Fillbots would be 2, and so on. If it's an endless game, add 100.
// If it's a rhythm toy, add 200. If it's a 2-Player endless game, add 300. If it's a credits