basic logic, sfx

🤩
This commit is contained in:
AstrlJelly 2024-01-22 15:16:48 -05:00
parent 2b94552f2f
commit b4df76232f
31 changed files with 569 additions and 82 deletions

File diff suppressed because one or more lines are too long

View file

@ -188,7 +188,7 @@ GameObject:
- component: {fileID: 5705939976271418400} - component: {fileID: 5705939976271418400}
- component: {fileID: 80224242047233675} - component: {fileID: 80224242047233675}
m_Layer: 0 m_Layer: 0
m_Name: Button2Sheen m_Name: ButtonSheen
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -932,7 +932,7 @@ GameObject:
- component: {fileID: 7018380361558107579} - component: {fileID: 7018380361558107579}
- component: {fileID: 2214261874876006399} - component: {fileID: 2214261874876006399}
m_Layer: 0 m_Layer: 0
m_Name: Button2 m_Name: Button
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -1017,7 +1017,7 @@ GameObject:
- component: {fileID: 632676952914094258} - component: {fileID: 632676952914094258}
- component: {fileID: 8352925964403526787} - component: {fileID: 8352925964403526787}
m_Layer: 0 m_Layer: 0
m_Name: Button3Sheen m_Name: ButtonSheen
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -1198,7 +1198,7 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4661475570310962003} m_GameObject: {fileID: 4661475570310962003}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -1240,7 +1240,7 @@ GameObject:
- component: {fileID: 2526336762666513033} - component: {fileID: 2526336762666513033}
- component: {fileID: 2877045166871582979} - component: {fileID: 2877045166871582979}
m_Layer: 0 m_Layer: 0
m_Name: Button3Bottom m_Name: ButtonBottom
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -1379,7 +1379,7 @@ GameObject:
- component: {fileID: 4215757215353579465} - component: {fileID: 4215757215353579465}
- component: {fileID: 4790761080377207371} - component: {fileID: 4790761080377207371}
m_Layer: 0 m_Layer: 0
m_Name: Button1Bottom m_Name: ButtonBottom
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -1521,7 +1521,7 @@ GameObject:
- component: {fileID: 3521202538311462670} - component: {fileID: 3521202538311462670}
- component: {fileID: 6479832831682828701} - component: {fileID: 6479832831682828701}
m_Layer: 0 m_Layer: 0
m_Name: Button1 m_Name: Button
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -1722,7 +1722,7 @@ GameObject:
- component: {fileID: 8459459139629761521} - component: {fileID: 8459459139629761521}
- component: {fileID: 4449036682437390073} - component: {fileID: 4449036682437390073}
m_Layer: 0 m_Layer: 0
m_Name: Button3 m_Name: Button
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -2454,7 +2454,7 @@ GameObject:
- component: {fileID: 5525398603149633671} - component: {fileID: 5525398603149633671}
- component: {fileID: 6069226680631927887} - component: {fileID: 6069226680631927887}
m_Layer: 0 m_Layer: 0
m_Name: Button2Bottom m_Name: ButtonBottom
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -2538,7 +2538,7 @@ GameObject:
- component: {fileID: 2709762901739230509} - component: {fileID: 2709762901739230509}
- component: {fileID: 3598601181653987301} - component: {fileID: 3598601181653987301}
m_Layer: 0 m_Layer: 0
m_Name: Button1Sheen m_Name: ButtonSheen
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -2552,7 +2552,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9212153283773584803} m_GameObject: {fileID: 9212153283773584803}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.17900002, y: 0.2550001, z: 0} m_LocalPosition: {x: 0.179, y: 0.2550001, z: 0}
m_LocalScale: {x: 0.8024, y: 1, z: 1} m_LocalScale: {x: 0.8024, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []

View file

@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0 m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0 m_IsAlphaChannelOptional: 0
serializedVersion: 5 serializedVersion: 5
m_Width: 1262 m_Width: 2124
m_Height: 709 m_Height: 1194
m_AntiAliasing: 2 m_AntiAliasing: 2
m_MipCount: -1 m_MipCount: -1
m_DepthStencilFormat: 92 m_DepthStencilFormat: 92

View file

@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0 m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0 m_IsAlphaChannelOptional: 0
serializedVersion: 5 serializedVersion: 5
m_Width: 1893 m_Width: 3186
m_Height: 1063 m_Height: 1791
m_AntiAliasing: 1 m_AntiAliasing: 1
m_MipCount: -1 m_MipCount: -1
m_DepthStencilFormat: 92 m_DepthStencilFormat: 92

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: e9ab216893d3c8947b108638a27d6b47
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

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

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 747e4942141b0dc45816da6edb55e0fb
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: beb6e74889ddd4449a84fc1b33f0290a
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 3a1d6d325fb5c4e4299486287db19abb
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: c7735e5c0e1d09e4596b6f6a7bb37148
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 92576452f1acb894088158cc6bd24400
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: c81773ee3338f1e4e8f8157b19cbde23
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 96bb287392c07e041b15d99377a03242
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 7795538856f26474ea971fdbee923c76
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 49642b6d7cc6cbe4daa3a1f7f01fd6cb
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: f0a9c150392c1224ea9cb2ff91dc5bc0
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

@ -14,7 +14,32 @@ AnimationClip:
m_RotationCurves: [] m_RotationCurves: []
m_CompressedRotationCurves: [] m_CompressedRotationCurves: []
m_EulerCurves: [] m_EulerCurves: []
m_PositionCurves: [] m_PositionCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: {x: -0.02, y: -0.01, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.083333336
value: {x: 0.179, y: 0.2550001, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
path: Button/ButtonSheen
m_ScaleCurves: [] m_ScaleCurves: []
m_FloatCurves: [] m_FloatCurves: []
m_PPtrCurves: [] m_PPtrCurves: []
@ -24,14 +49,21 @@ AnimationClip:
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
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: 2725912158
attribute: 1
script: {fileID: 0}
typeID: 4
customType: 0
isPPtrCurve: 0
pptrCurveMapping: [] pptrCurveMapping: []
m_AnimationClipSettings: m_AnimationClipSettings:
serializedVersion: 2 serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0 m_AdditiveReferencePoseTime: 0
m_StartTime: 0 m_StartTime: 0
m_StopTime: 1 m_StopTime: 0.083333336
m_OrientationOffsetY: 0 m_OrientationOffsetY: 0
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
@ -46,7 +78,91 @@ AnimationClip:
m_KeepOriginalPositionXZ: 0 m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0 m_HeightFromFeet: 0
m_Mirror: 0 m_Mirror: 0
m_EditorCurves: [] m_EditorCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: -0.02
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0.179
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.x
path: Button/ButtonSheen
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: -0.01
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0.2550001
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.y
path: Button/ButtonSheen
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.z
path: Button/ButtonSheen
classID: 4
script: {fileID: 0}
m_EulerEditorCurves: [] m_EulerEditorCurves: []
m_HasGenericRootTransform: 0 m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0 m_HasMotionFloatCurves: 0

View file

@ -873,7 +873,7 @@ AnimationClip:
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
m_HasAdditiveReferencePose: 0 m_HasAdditiveReferencePose: 0
m_LoopTime: 1 m_LoopTime: 0
m_LoopBlend: 0 m_LoopBlend: 0
m_LoopBlendOrientation: 0 m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0 m_LoopBlendPositionY: 0

View file

@ -303,7 +303,7 @@ AnimationClip:
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
m_HasAdditiveReferencePose: 0 m_HasAdditiveReferencePose: 0
m_LoopTime: 1 m_LoopTime: 0
m_LoopBlend: 0 m_LoopBlend: 0
m_LoopBlendOrientation: 0 m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0 m_LoopBlendPositionY: 0

View file

@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Loaders
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
SlotMonster.instance.StartInterval(e.beat, e.length, e["auto"], e, e.beat); SlotMonster.instance.StartInterval(e.beat, e.length, e["auto"], e, 0);
}, },
defaultLength = 3f, defaultLength = 3f,
resizable = true, resizable = true,
@ -35,10 +35,18 @@ namespace HeavenStudio.Games.Loaders
new GameAction("slot", "Slot") new GameAction("slot", "Slot")
{ {
defaultLength = 0.5f, defaultLength = 0.5f,
parameters = new List<Param>()
{
new Param("drum", SlotMonster.DrumTypes.Default, "Drum SFX", "Set the drum SFX to be used. Default is Bass on the beat, and Snare off the beat.")
},
priority = 1, priority = 1,
}, },
new GameAction("passTurn", "Pass Turn") new GameAction("passTurn", "Pass Turn")
{ {
function = delegate {
var e = eventCaller.currentEntity;
SlotMonster.instance.PassTurn(e.beat, e.length);
},
defaultLength = 1f, defaultLength = 1f,
priority = 1, priority = 1,
}, },
@ -52,6 +60,13 @@ namespace HeavenStudio.Games
{ {
public class SlotMonster : Minigame public class SlotMonster : Minigame
{ {
public enum DrumTypes
{
Default,
Bass,
Snare,
}
[Header("Animators")] [Header("Animators")]
[SerializeField] Animator smAnim; [SerializeField] Animator smAnim;
[SerializeField] Animator[] eyeAnims; [SerializeField] Animator[] eyeAnims;
@ -86,6 +101,11 @@ namespace HeavenStudio.Games
} }
} }
public override void OnPlay(double beat)
{
OnGameSwitch(beat);
}
// make sure the current button is always between 0 and 2 (buttons 1-3) // make sure the current button is always between 0 and 2 (buttons 1-3)
private int GetCurrentButton() => currentButton %= 3; private int GetCurrentButton() => currentButton %= 3;
@ -105,48 +125,64 @@ namespace HeavenStudio.Games
public void StartInterval(double beat, float length, bool autoPass, RiqEntity startInterval, double gameSwitchBeat) public void StartInterval(double beat, float length, bool autoPass, RiqEntity startInterval, double gameSwitchBeat)
{ {
List<RiqEntity> slotActions = gameEntities.FindAll(e => e.datamodel == "slotMonster/slot" && e.beat > startInterval.beat && e.beat < startInterval.beat + startInterval.length); List<RiqEntity> slotActions = gameEntities.FindAll(e => e.datamodel == "slotMonster/slot" && e.beat >= startInterval.beat && e.beat < startInterval.beat + startInterval.length);
smAnim.DoScaledAnimationFromBeatAsync("Prepare", 0.5f, beat); smAnim.DoScaledAnimationFromBeatAsync("Prepare", 0.5f, beat);
SoundByte.PlayOneShotGame("slotMonster/start_touch", forcePlay: true); SoundByte.PlayOneShotGame("slotMonster/start_touch", forcePlay: true);
Debug.Log(Mathf.Min(slotActions.Count, 3));
List<MultiSound.Sound> sounds = new();
List<BeatAction.Action> actions = new();
for (int i = 0; i < Mathf.Min(slotActions.Count, 3); i++) // limit to 3 actions
{
int whichSlot = i;
RiqEntity slot = slotActions[whichSlot];
if (slot.beat < gameSwitchBeat) continue;
string sfx = "";
if (slot["drum"] == (int)DrumTypes.Default) {
sfx = slot.beat % 1 == 0 ? "bass" : "snare";
} else {
sfx = Enum.GetName(typeof(DrumTypes), (int)slot["drum"]).ToLower();
}
Debug.Log(sfx);
sounds.Add(new(sfx + "DrumNTR", slot.beat));
actions.Add(new(slot.beat, delegate {
buttonAnims[whichSlot].DoScaledAnimationAsync("Flash", 0.5f);
}));
}
MultiSound.Play(sounds.ToArray(), false);
BeatAction.New(this, actions);
if (autoPass) {
BeatAction.New(this, new() { new(beat + length, delegate { PassTurn(beat + length, 1, beat, slotActions); }) });
}
}
public void PassTurn(double beat, float length, double startBeat = -1, List<RiqEntity> slotActions = null)
{
smAnim.DoScaledAnimationFromBeatAsync("Release", 0.5f, beat);
foreach (var eye in eyeAnims) foreach (var eye in eyeAnims)
{ {
eye.DoScaledAnimationAsync("Spin", 0.5f); eye.DoScaledAnimationAsync("Spin", 0.5f);
} }
List<BeatAction.Action> actions = new();
for (int i = 0; i < Mathf.Min(slotActions.Count, 3); i++) // limit to 3 actions
{
double slotBeat = slotActions[i].beat;
if (slotBeat > gameSwitchBeat) continue;
actions.Add(new(slotBeat, delegate {
buttonAnims[i].DoScaledAnimationAsync("Flash", 0.5f);
}));
}
BeatAction.New(this, actions);
if (autoPass) {
PassTurn(beat + length, slotActions);
}
}
public void PassTurn(double beat, List<RiqEntity> slotActions = null)
{
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 (slotActions == null) { if (slotActions == null) {
var startInterval = gameEntities.FindLast(e => e.datamodel == "slotMonster/startInterval" && e.beat + e.length < beat); var startInterval = gameEntities.FindLast(e => e.datamodel == "slotMonster/startInterval" && e.beat + e.length < beat);
slotActions = gameEntities.FindAll(e => e.datamodel == "slotMonster/slot" && e.beat > startInterval.beat && e.beat < startInterval.beat + startInterval.length); if (startBeat < 0) startBeat = startInterval.beat;
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
{ {
int whichSlot = i; int whichSlot = i;
double slotBeat = slotActions[i].beat;
actions.Add(new(slotActions[whichSlot].beat, delegate { buttonAnims[whichSlot].DoScaledAnimationAsync("Flash"); })); actions.Add(new(slotBeat + beat, delegate { buttonAnims[whichSlot].DoScaledAnimationAsync("Flash"); }));
PlayerActionEvent input = ScheduleInput(beat, slotActions[i].beat, InputAction_BasicPress, ButtonHit, null, null); Debug.Log("input scheduled at : " + (beat + slotBeat - startBeat + 1));
PlayerActionEvent input = ScheduleInput(beat, slotBeat - startBeat + 1, InputAction_BasicPress, ButtonHit, null, null);
input.IsHittable = () => GetCurrentButton() == whichSlot; input.IsHittable = () => GetCurrentButton() == whichSlot;
} }
BeatAction.New(this, actions); BeatAction.New(this, actions);
@ -154,7 +190,11 @@ namespace HeavenStudio.Games
private void ButtonHit(PlayerActionEvent caller, float state) private void ButtonHit(PlayerActionEvent caller, float state)
{ {
HitButton(true); bool isWin = HitButton(true);
if (isWin) {
if (rollingSound != null) rollingSound.Stop();
smAnim.DoScaledAnimationAsync("Win", 0.5f);
}
if (state is >= 1f or <= -1f) SoundByte.PlayOneShot("nearMiss"); if (state is >= 1f or <= -1f) SoundByte.PlayOneShot("nearMiss");
} }