READY FOR RECORDING

particles, win animation, etc.
This commit is contained in:
AstrlJelly 2024-02-15 22:03:56 -05:00
parent a8c585bd93
commit b01361cc0c
13 changed files with 5465 additions and 88 deletions

File diff suppressed because it is too large Load diff

View file

@ -28,8 +28,8 @@ AnimationClip:
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: {x: 0, y: 0.845, z: 0} value: {x: 0, y: 0.798, z: 0}
inSlope: {x: 0, y: 0, z: 0} inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0 tangentMode: 0
@ -53,7 +53,7 @@ AnimationClip:
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: {x: 0, y: 0.44299993, z: 0} value: {x: 0, y: 0.44299993, z: 0}
inSlope: {x: 0, y: 0, z: 0} inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0}
@ -79,7 +79,7 @@ AnimationClip:
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: {x: 1, y: 1, z: 1} value: {x: 1, y: 1, z: 1}
inSlope: {x: 0, y: 0, z: 0} inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0}
@ -156,7 +156,7 @@ AnimationClip:
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: 1 value: 1
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
@ -184,7 +184,7 @@ AnimationClip:
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: 1 value: 1
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
@ -212,7 +212,7 @@ AnimationClip:
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: 1 value: 1
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
@ -240,7 +240,7 @@ AnimationClip:
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: 0 value: 0
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
@ -268,8 +268,8 @@ AnimationClip:
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: 0.845 value: 0.798
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
tangentMode: 136 tangentMode: 136
@ -296,7 +296,7 @@ AnimationClip:
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: 0 value: 0
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
@ -324,7 +324,7 @@ AnimationClip:
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: 0 value: 0
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
@ -352,7 +352,7 @@ AnimationClip:
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: 0.44299993 value: 0.44299993
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0
@ -380,7 +380,7 @@ AnimationClip:
inWeight: 0.33333334 inWeight: 0.33333334
outWeight: 0.33333334 outWeight: 0.33333334
- serializedVersion: 3 - serializedVersion: 3
time: 0.05 time: 0.06666667
value: 0 value: 0
inSlope: 0 inSlope: 0
outSlope: 0 outSlope: 0

View file

@ -145,7 +145,26 @@ AnimationClip:
m_RotationOrder: 4 m_RotationOrder: 4
path: Hand path: Hand
m_ScaleCurves: [] m_ScaleCurves: []
m_FloatCurves: [] m_FloatCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_PPtrCurves: [] m_PPtrCurves: []
m_SampleRate: 60 m_SampleRate: 60
m_WrapMode: 0 m_WrapMode: 0
@ -175,6 +194,13 @@ AnimationClip:
typeID: 4 typeID: 4
customType: 4 customType: 4
isPPtrCurve: 0 isPPtrCurve: 0
- serializedVersion: 2
path: 2485469132
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
pptrCurveMapping: [] pptrCurveMapping: []
m_AnimationClipSettings: m_AnimationClipSettings:
serializedVersion: 2 serializedVersion: 2
@ -611,6 +637,25 @@ AnimationClip:
path: Hand path: Hand
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: m_EulerEditorCurves:
- curve: - curve:
serializedVersion: 2 serializedVersion: 2

View file

@ -160,7 +160,26 @@ AnimationClip:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
path: Head path: Head
m_FloatCurves: [] m_FloatCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_PPtrCurves: m_PPtrCurves:
- curve: - curve:
- time: 0 - time: 0
@ -176,6 +195,13 @@ AnimationClip:
m_Extent: {x: 0, y: 0, z: 0} m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant: m_ClipBindingConstant:
genericBindings: genericBindings:
- serializedVersion: 2
path: 2485469132
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2 - serializedVersion: 2
path: 130111906 path: 130111906
attribute: 0 attribute: 0
@ -782,6 +808,25 @@ AnimationClip:
path: Body path: Body
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: m_EulerEditorCurves:
- curve: - curve:
serializedVersion: 2 serializedVersion: 2

View file

@ -179,7 +179,26 @@ AnimationClip:
m_RotationOrder: 4 m_RotationOrder: 4
path: Head path: Head
m_ScaleCurves: [] m_ScaleCurves: []
m_FloatCurves: [] m_FloatCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_PPtrCurves: m_PPtrCurves:
- curve: - curve:
- time: 0 - time: 0
@ -223,6 +242,13 @@ AnimationClip:
typeID: 4 typeID: 4
customType: 4 customType: 4
isPPtrCurve: 0 isPPtrCurve: 0
- serializedVersion: 2
path: 2485469132
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2 - serializedVersion: 2
path: 130111906 path: 130111906
attribute: 0 attribute: 0
@ -778,6 +804,25 @@ AnimationClip:
path: Head path: Head
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: m_EulerEditorCurves:
- curve: - curve:
serializedVersion: 2 serializedVersion: 2

View file

@ -288,6 +288,25 @@ AnimationClip:
path: Head/Mouth path: Head/Mouth
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_PPtrCurves: m_PPtrCurves:
- curve: - curve:
- time: 0 - time: 0
@ -373,6 +392,13 @@ AnimationClip:
typeID: 1 typeID: 1
customType: 0 customType: 0
isPPtrCurve: 0 isPPtrCurve: 0
- serializedVersion: 2
path: 2485469132
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2 - serializedVersion: 2
path: 130111906 path: 130111906
attribute: 0 attribute: 0
@ -1259,6 +1285,25 @@ AnimationClip:
path: Head/Mouth path: Head/Mouth
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: m_EulerEditorCurves:
- curve: - curve:
serializedVersion: 2 serializedVersion: 2

View file

@ -544,7 +544,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: 1 value: 700
inSlope: Infinity inSlope: Infinity
outSlope: Infinity outSlope: Infinity
tangentMode: 103 tangentMode: 103
@ -595,6 +595,44 @@ AnimationClip:
path: Head/Mouth path: Head/Mouth
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 725
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_SortingOrder
path: Head
classID: 212
script: {fileID: 0}
m_PPtrCurves: m_PPtrCurves:
- curve: - curve:
- time: 0 - time: 0
@ -700,6 +738,20 @@ AnimationClip:
typeID: 1 typeID: 1
customType: 0 customType: 0
isPPtrCurve: 0 isPPtrCurve: 0
- serializedVersion: 2
path: 2485469132
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 130111906
attribute: 3762991556
script: {fileID: 0}
typeID: 212
customType: 26
isPPtrCurve: 0
- serializedVersion: 2 - serializedVersion: 2
path: 130111906 path: 130111906
attribute: 0 attribute: 0
@ -2393,7 +2445,7 @@ AnimationClip:
m_Curve: m_Curve:
- serializedVersion: 3 - serializedVersion: 3
time: 0 time: 0
value: 1 value: 700
inSlope: Infinity inSlope: Infinity
outSlope: Infinity outSlope: Infinity
tangentMode: 103 tangentMode: 103
@ -2444,6 +2496,44 @@ AnimationClip:
path: Head/Mouth path: Head/Mouth
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 725
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_SortingOrder
path: Head
classID: 212
script: {fileID: 0}
m_EulerEditorCurves: m_EulerEditorCurves:
- curve: - curve:
serializedVersion: 2 serializedVersion: 2

View file

@ -459,7 +459,26 @@ AnimationClip:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
path: Head path: Head
m_FloatCurves: [] m_FloatCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_PPtrCurves: m_PPtrCurves:
- curve: - curve:
- time: 0 - time: 0
@ -531,6 +550,13 @@ AnimationClip:
typeID: 4 typeID: 4
customType: 0 customType: 0
isPPtrCurve: 0 isPPtrCurve: 0
- serializedVersion: 2
path: 2485469132
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2 - serializedVersion: 2
path: 130111906 path: 130111906
attribute: 0 attribute: 0
@ -1962,6 +1988,25 @@ AnimationClip:
path: Hand path: Hand
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Head/HeadCover
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: m_EulerEditorCurves:
- curve: - curve:
serializedVersion: 2 serializedVersion: 2

View file

@ -902,6 +902,27 @@ TextureImporter:
indices: indices:
edges: [] edges: []
weights: [] weights: []
- serializedVersion: 2
name: SlotMonster_29
rect:
serializedVersion: 2
x: 1530
y: 1374
width: 277
height: 346
alignment: 9
pivot: {x: 0.5, y: 0.351}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: e0c73a35dd3facd4480bf264b49d929d
internalID: -32620696
vertices: []
indices:
edges: []
weights: []
outline: [] outline: []
physicsShape: [] physicsShape: []
bones: [] bones: []

View file

@ -11,51 +11,66 @@ namespace HeavenStudio.Games.Scripts_SlotMonster
public class SlotButton : MonoBehaviour public class SlotButton : MonoBehaviour
{ {
public bool pressed; public bool pressed;
// public double timing;
public Color color; // used to ease between button colors and button flash colors! wow public Color color; // used to ease between button colors and button flash colors! wow
public PlayerActionEvent input;
public bool missed;
[Header("Components")]
public Animator anim; public Animator anim;
public SpriteRenderer[] srs; [SerializeField] SpriteRenderer[] srs;
private bool flashing; private bool flashing;
const int FLASH_FRAMES = 4; private const float FLASH_FRAMES = 4f;
private int currentFrame; private int currentFrame;
private SlotMonster game; private SlotMonster game;
public void Init(SlotMonster instance) public void Init(SlotMonster instance)
{ {
color = srs[0].color;
game = instance; game = instance;
pressed = true;
color = srs[0].color;
} }
private void LateUpdate() private void LateUpdate()
{ {
if (flashing) { Color newColor = color;
foreach (var sr in srs) { if (pressed) {
// sr.color = Color.Lerp(color, game.buttonFlashColor, currentFrame / FRAMES); newColor = Color.LerpUnclamped(color, Color.black, 0.5f);
} else if (flashing) {
var normalized = currentFrame / FLASH_FRAMES; float normalized = currentFrame / FLASH_FRAMES;
Debug.Log("normalized : " + normalized);
float newR = EasingFunction.Linear(game.buttonFlashColor.r, color.r, normalized); float newR = EasingFunction.Linear(game.buttonFlashColor.r, color.r, normalized);
float newG = EasingFunction.Linear(game.buttonFlashColor.g, color.g, normalized); float newG = EasingFunction.Linear(game.buttonFlashColor.g, color.g, normalized);
float newB = EasingFunction.Linear(game.buttonFlashColor.b, color.b, normalized); float newB = EasingFunction.Linear(game.buttonFlashColor.b, color.b, normalized);
sr.color = new Color(newR, newG, newB); newColor = new Color(newR, newG, newB);
Debug.Log("sr.color : " + sr.color); // Debug.Log("currentFrame / FLASH_FRAMES : " + currentFrame + "/" + FLASH_FRAMES);
Debug.Log("currentFrame : " + currentFrame); // newColor = Color.LerpUnclamped(color, game.buttonFlashColor, normalized);
} // Debug.Log("color : " + color);
} else { // Debug.Log("newColor : " + newColor);
foreach (var sr in srs) {
sr.color = color;
}
}
} }
public void Press() foreach (var sr in srs) {
sr.color = newColor;
}
// Color newColor = Color.LerpUnclamped(color, tempColor, 0.45f);
// foreach (var sr in srs) {
// sr.color = color;
// }
}
public void Press(bool isHit)
{ {
anim.DoScaledAnimationAsync("Press", 0.5f); anim.DoScaledAnimationAsync("Press", 0.5f);
pressed = true; pressed = true;
if (!isHit) {
missed = true;
input.Disable();
input.CleanUp();
}
} }
public void TryFlash() public void TryFlash()

View file

@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Loaders
function = delegate { function = delegate {
if (eventCaller.gameManager.minigameObj.TryGetComponent(out SlotMonster instance)) { if (eventCaller.gameManager.minigameObj.TryGetComponent(out SlotMonster instance)) {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
instance.StartInterval(e.beat, e.length, e["auto"], e["eyeType"], 0); instance.StartInterval(e, e["auto"], e["eyeType"], 0);
} }
}, },
defaultLength = 3f, defaultLength = 3f,
@ -77,6 +77,24 @@ namespace HeavenStudio.Games.Loaders
new Param("flash", new Color(1f, 1f, 0.68f), "Button Flash Color", "Set the color of the flash of the buttons."), new Param("flash", new Color(1f, 1f, 0.68f), "Button Flash Color", "Set the color of the flash of the buttons."),
}, },
}, },
new GameAction("gameplayModifiers", "Gameplay Modifiers")
{
function = delegate {
if (eventCaller.gameManager.minigameObj.TryGetComponent(out SlotMonster instance)) {
var e = eventCaller.currentEntity;
instance.GameplayModifiers(e["lottery"], e["stars"]);
}
},
defaultLength = 0.5f,
priority = 1,
parameters = new List<Param>()
{
new Param("lottery", true, "Lottery", "Toggle if the win particles should play after a successful sequence.", new() {
new Param.CollapseParam((x, _) => (bool)x, new string[] { "stars" }),
}),
new Param("stars", false, "Use Stars", "Use stars instead of coins? (From the Korean version of RH DS)"),
},
},
} }
); );
} }
@ -85,6 +103,7 @@ namespace HeavenStudio.Games.Loaders
namespace HeavenStudio.Games namespace HeavenStudio.Games
{ {
using System.Linq;
using Scripts_SlotMonster; using Scripts_SlotMonster;
public class SlotMonster : Minigame public class SlotMonster : Minigame
{ {
@ -114,10 +133,13 @@ namespace HeavenStudio.Games
[SerializeField] Animator smAnim; [SerializeField] Animator smAnim;
[SerializeField] Animator[] eyeAnims; [SerializeField] Animator[] eyeAnims;
[Header("Objects")]
[SerializeField] SlotButton[] buttons; [SerializeField] SlotButton[] buttons;
public Color buttonFlashColor; [SerializeField] ParticleSystem winParticles;
public Color buttonFlashColor = new(1f, 1f, 0.68f);
private List<RiqEntity> gameEntities; private List<RiqEntity> gameEntities;
private bool doWin = true;
private Sound rollingSound; private Sound rollingSound;
private int currentEyeSprite = 1; private int currentEyeSprite = 1;
@ -146,9 +168,9 @@ namespace HeavenStudio.Games
public override void OnGameSwitch(double beat) public override void OnGameSwitch(double beat)
{ {
gameEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel.Split('/')[0] == "slotMonster"); gameEntities = gameManager.Beatmap.Entities.FindAll(c => c.datamodel.Split('/')[0] == "slotMonster");
foreach (RiqEntity e in gameEntities.FindAll(e => e.datamodel == "slotMonster/startInterval" && e.beat < beat && e.beat + e.length > beat)) { foreach (RiqEntity e in gameEntities.FindAll(e => e.datamodel == "slotMonster/startInterval" && e.beat < beat && e.beat + e.length > beat)) {
StartInterval(e.beat, e.length, e["auto"], e["eyeType"], beat); StartInterval(e, e["auto"], e["eyeType"], beat);
} }
} }
@ -160,26 +182,22 @@ namespace HeavenStudio.Games
int thisButton = GetCurrentButton(); int thisButton = GetCurrentButton();
if (thisButton == -1) return false; if (thisButton == -1) return false;
bool isLast = thisButton == maxButtons - 1; bool isLast = thisButton == maxButtons - 1;
string hitSfx = "slotMonster/stop_" + (isLast && isHit ? "hit" : (thisButton + 1));
SoundByte.PlayOneShotGame(hitSfx, forcePlay: true);
for (int i = thisButton; i < (isLast ? 3 : thisButton + 1); i++) for (int i = thisButton; i < (isLast ? 3 : thisButton + 1); i++)
{ {
buttons[thisButton].Press(); buttons[thisButton].Press(isHit);
if (eyeAnims[thisButton].IsPlayingAnimationNames("Spin")) { if (eyeAnims[thisButton].IsPlayingAnimationNames("Spin")) {
int eyeSprite = currentEyeSprite; int eyeSprite = currentEyeSprite;
string anim = "EyeItem"; string anim = "EyeItem";
if (!isHit) { if (!isHit) {
do { eyeSprite = UnityEngine.Random.Range(1, 9);
eyeSprite = UnityEngine.Random.Range(0, 9); if (eyeSprite >= currentEyeSprite) eyeSprite++;
} while (eyeSprite == (currentEyeSprite - 1)); anim += eyeSprite;
anim += eyeSprite + 1; } else { // only do all this if it's actually a hit
} else { if (timing == -1) { // if the timing is early
if (timing == 1) {
eyeSprite = (eyeSprite + 1) % 9; eyeSprite = (eyeSprite + 1) % 9;
} }
anim += eyeSprite + 1; anim += eyeSprite + 1;
if (timing != 0) { if (timing != 0) { // if it's a barely
// string += lol
anim += "Barely"; anim += "Barely";
} }
} }
@ -187,19 +205,27 @@ namespace HeavenStudio.Games
eyeAnims[thisButton].Play(anim, 0, 0); eyeAnims[thisButton].Play(anim, 0, 0);
} }
} }
bool isMiss = buttons.Any(x => x.missed);
string hitSfx = "slotMonster/stop_" + (isLast && isHit && !isMiss ? "hit" : (thisButton + 1));
SoundByte.PlayOneShotGame(hitSfx, forcePlay: true);
if (isLast) { if (isLast) {
if (rollingSound != null) rollingSound.Stop(); if (rollingSound != null) rollingSound.Stop();
if (isHit && doWin) {
SoundByte.PlayOneShotGame("slotMonster/win");
winParticles.Play();
}
} }
currentButton++; currentButton++;
return isLast && isHit; return isLast && isHit;
} }
public void StartInterval(double beat, float length, bool autoPass, int eyeSprite, double gameSwitchBeat) public void StartInterval(RiqEntity si, bool autoPass, int eyeSprite, double gameSwitchBeat)
{ {
List<RiqEntity> slotActions = gameEntities.FindAll(e => e.datamodel == "slotMonster/slot" && e.beat >= beat && e.beat < beat + length); List<RiqEntity> slotActions = gameEntities.FindAll(e => e.datamodel == "slotMonster/slot" && e.beat >= si.beat && e.beat < si.beat + si.length);
if (slotActions.Count <= 0) return;
SoundByte.PlayOneShotGame("slotMonster/start_touch", forcePlay: true); SoundByte.PlayOneShotGame("slotMonster/start_touch", forcePlay: true);
smAnim.DoScaledAnimationFromBeatAsync("Prepare", 0.5f, beat); smAnim.DoScaledAnimationFromBeatAsync("Prepare", 0.5f, si.beat);
foreach (var button in buttons) { foreach (var button in buttons) {
button.anim.Play("PopUp", 0, 1); button.anim.Play("PopUp", 0, 1);
} }
@ -232,14 +258,14 @@ namespace HeavenStudio.Games
BeatAction.New(this, actions); BeatAction.New(this, actions);
if (autoPass) { if (autoPass) {
BeatAction.New(this, new() { new(beat + length, delegate { BeatAction.New(this, new() { new(si.beat + si.length, delegate {
currentEyeSprite = eyeSprite == 0 ? UnityEngine.Random.Range(1, 10) : eyeSprite; currentEyeSprite = eyeSprite == 0 ? UnityEngine.Random.Range(1, 10) : eyeSprite;
PassTurn(beat + length, 1, beat, slotActions); PassTurn(si.beat + si.length, 1, si.beat, si, slotActions);
})}); })});
} }
} }
public void PassTurn(double beat, float length, double startBeat = -1, List<RiqEntity> slotActions = null) public void PassTurn(double beat, float length, double startBeat = -1, RiqEntity startInterval = null, List<RiqEntity> slotActions = null)
{ {
smAnim.DoScaledAnimationFromBeatAsync("Release", 0.5f, beat); smAnim.DoScaledAnimationFromBeatAsync("Release", 0.5f, beat);
for (int i = 0; i < eyeAnims.Length; i++) { for (int i = 0; i < eyeAnims.Length; i++) {
@ -247,11 +273,12 @@ namespace HeavenStudio.Games
} }
SoundByte.PlayOneShotGame("slotMonster/start_rolling", forcePlay: true); SoundByte.PlayOneShotGame("slotMonster/start_rolling", forcePlay: true);
rollingSound = SoundByte.PlayOneShotGame("slotMonster/rolling", looping: true, forcePlay: true); rollingSound = SoundByte.PlayOneShotGame("slotMonster/rolling", looping: true, forcePlay: true);
if (startBeat < 0 || slotActions == null) {
var startInterval = gameEntities.FindLast(e => e.datamodel == "slotMonster/startInterval" && e.beat + e.length < beat); startInterval ??= gameEntities.FindLast(e => e.datamodel == "slotMonster/startInterval" && e.beat + e.length < beat);
if (startBeat < 0) {
startBeat = startInterval.beat; startBeat = startInterval.beat;
slotActions ??= gameEntities.FindAll(e => e.datamodel == "slotMonster/slot" && e.beat >= startInterval.beat && e.beat < startInterval.beat + startInterval.length);
} }
slotActions ??= gameEntities.FindAll(e => e.datamodel == "slotMonster/slot" && e.beat >= startInterval.beat && e.beat < startInterval.beat + startInterval.length);
List<BeatAction.Action> actions = new(); List<BeatAction.Action> actions = new();
for (int i = 0; i < Mathf.Min(slotActions.Count, 3); i++) // limit to 3 actions for (int i = 0; i < Mathf.Min(slotActions.Count, 3); i++) // limit to 3 actions
@ -263,12 +290,16 @@ namespace HeavenStudio.Games
buttons[whichSlot].TryFlash(); buttons[whichSlot].TryFlash();
})); }));
PlayerActionEvent input = ScheduleInput(beat, slotBeat - startBeat + length, InputAction_BasicPress, ButtonHit, null, null); PlayerActionEvent input = ScheduleInput(beat, slotBeat - startBeat + length, InputAction_BasicPress, ButtonHit, null, null, () => {
// input.IsHittable = () => { // ugh this breaks the input check return GetCurrentButton() == whichSlot && !buttons[whichSlot].pressed;
// int currentButton = GetCurrentButton(); });
// return currentButton == whichSlot && !buttonsPressed[whichSlot];
// };
} }
actions.Add(new(beat + length + startInterval.beat + startInterval.length, delegate {
if (rollingSound != null) rollingSound.Stop();
if (buttons.Any(x => x.missed)) { // if it's a miss
smAnim.DoScaledAnimationAsync("Lose", 0.5f);
}
}));
BeatAction.New(this, actions); BeatAction.New(this, actions);
} }
@ -294,5 +325,11 @@ namespace HeavenStudio.Games
} }
buttonFlashColor = flashColor; buttonFlashColor = flashColor;
} }
public void GameplayModifiers(bool lottery, bool stars)
{
// var sheetAnim = winParticles.textureSheetAnimation;
doWin = lottery;
}
} }
} }