eye barelies, consecutive c&rs
we're so close!
This commit is contained in:
parent
56ac82c753
commit
fe6d213aac
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
using HeavenStudio.Util;
|
using HeavenStudio.Util;
|
||||||
|
@ -10,14 +11,15 @@ 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 Animator anim;
|
public Animator anim;
|
||||||
public SpriteRenderer[] srs;
|
public SpriteRenderer[] srs;
|
||||||
|
|
||||||
public bool flashing;
|
private bool flashing;
|
||||||
const int FLASH_FRAMES = 4;
|
const int FLASH_FRAMES = 4;
|
||||||
public int currentFrame;
|
private int currentFrame;
|
||||||
|
|
||||||
private SlotMonster game;
|
private SlotMonster game;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
using HeavenStudio.Util;
|
using HeavenStudio.Util;
|
||||||
using HeavenStudio.InputSystem;
|
using HeavenStudio.InputSystem;
|
||||||
|
|
||||||
using Jukebox;
|
using Jukebox;
|
||||||
using System.Linq;
|
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace HeavenStudio.Games.Loaders
|
namespace HeavenStudio.Games.Loaders
|
||||||
{
|
{
|
||||||
|
@ -156,32 +155,43 @@ namespace HeavenStudio.Games
|
||||||
// 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() => Array.FindIndex(buttons, button => !button.pressed);
|
private int GetCurrentButton() => Array.FindIndex(buttons, button => !button.pressed);
|
||||||
|
|
||||||
private bool HitButton(bool isHit = false) // returns true if it's the last one
|
private bool HitButton(bool isHit = false, int timing = 0) // returns true if it's the last one
|
||||||
{
|
{
|
||||||
int thisButton = GetCurrentButton();
|
int thisButton = GetCurrentButton();
|
||||||
if (thisButton == -1) return false;
|
if (thisButton == -1) return false;
|
||||||
bool lastButton = thisButton == maxButtons - 1;
|
bool isLast = thisButton == maxButtons - 1;
|
||||||
string hitSfx = "slotMonster/stop_" + (lastButton && isHit ? "hit" : (thisButton + 1));
|
string hitSfx = "slotMonster/stop_" + (isLast && isHit ? "hit" : (thisButton + 1));
|
||||||
SoundByte.PlayOneShotGame(hitSfx, forcePlay: true);
|
SoundByte.PlayOneShotGame(hitSfx, forcePlay: true);
|
||||||
for (int i = thisButton; i < (lastButton ? 3 : thisButton + 1); i++)
|
for (int i = thisButton; i < (isLast ? 3 : thisButton + 1); i++)
|
||||||
{
|
{
|
||||||
buttons[thisButton].Press();
|
buttons[thisButton].Press();
|
||||||
if (eyeAnims[thisButton].IsPlayingAnimationNames("Spin")) {
|
if (eyeAnims[thisButton].IsPlayingAnimationNames("Spin")) {
|
||||||
int eyeSprite = currentEyeSprite;
|
int eyeSprite = currentEyeSprite;
|
||||||
|
string anim = "EyeItem";
|
||||||
if (!isHit) {
|
if (!isHit) {
|
||||||
do {
|
do {
|
||||||
eyeSprite = UnityEngine.Random.Range(1, 10);
|
eyeSprite = UnityEngine.Random.Range(0, 9);
|
||||||
} while (eyeSprite == currentEyeSprite);
|
} while (eyeSprite == (currentEyeSprite - 1));
|
||||||
|
anim += eyeSprite + 1;
|
||||||
|
} else {
|
||||||
|
if (timing == 1) {
|
||||||
|
eyeSprite = (eyeSprite + 1) % 9;
|
||||||
|
}
|
||||||
|
anim += eyeSprite + 1;
|
||||||
|
if (timing != 0) {
|
||||||
|
// string += lol
|
||||||
|
anim += "Barely";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Debug.Log("EyeItem" + eyeSprite);
|
Debug.Log(anim);
|
||||||
eyeAnims[thisButton].Play("EyeItem" + eyeSprite, 0, 0);
|
eyeAnims[thisButton].Play(anim, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lastButton) {
|
if (isLast) {
|
||||||
if (rollingSound != null) rollingSound.Stop();
|
if (rollingSound != null) rollingSound.Stop();
|
||||||
}
|
}
|
||||||
currentButton++;
|
currentButton++;
|
||||||
return lastButton && isHit;
|
return isLast && isHit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartInterval(double beat, float length, bool autoPass, int eyeSprite, double gameSwitchBeat)
|
public void StartInterval(double beat, float length, bool autoPass, int eyeSprite, double gameSwitchBeat)
|
||||||
|
@ -200,8 +210,11 @@ namespace HeavenStudio.Games
|
||||||
for (int i = 0; i < maxButtons; i++) // limit to 3 actions
|
for (int i = 0; i < maxButtons; i++) // limit to 3 actions
|
||||||
{
|
{
|
||||||
buttons[i].anim.Play("PopUp", 0, 0);
|
buttons[i].anim.Play("PopUp", 0, 0);
|
||||||
|
buttons[i].pressed = false;
|
||||||
|
eyeAnims[i].Play("Idle", 0, 1);
|
||||||
int whichSlot = i;
|
int whichSlot = i;
|
||||||
RiqEntity slot = slotActions[whichSlot];
|
RiqEntity slot = slotActions[whichSlot];
|
||||||
|
// buttons[i].timing = slot.beat;
|
||||||
if (slot.beat < gameSwitchBeat) continue;
|
if (slot.beat < gameSwitchBeat) continue;
|
||||||
string sfx = "";
|
string sfx = "";
|
||||||
if (slot["drum"] == (int)DrumTypes.Default) {
|
if (slot["drum"] == (int)DrumTypes.Default) {
|
||||||
|
@ -250,9 +263,8 @@ namespace HeavenStudio.Games
|
||||||
buttons[whichSlot].TryFlash();
|
buttons[whichSlot].TryFlash();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Debug.Log("input scheduled at : " + (beat + length + slotBeat - startBeat));
|
|
||||||
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 = () => {
|
// input.IsHittable = () => { // ugh this breaks the input check
|
||||||
// int currentButton = GetCurrentButton();
|
// int currentButton = GetCurrentButton();
|
||||||
// return currentButton == whichSlot && !buttonsPressed[whichSlot];
|
// return currentButton == whichSlot && !buttonsPressed[whichSlot];
|
||||||
// };
|
// };
|
||||||
|
@ -262,7 +274,12 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
private void ButtonHit(PlayerActionEvent caller, float state)
|
private void ButtonHit(PlayerActionEvent caller, float state)
|
||||||
{
|
{
|
||||||
bool isWin = HitButton(true);
|
int timing = state switch {
|
||||||
|
>= 1f => -1,
|
||||||
|
<= -1f => 1,
|
||||||
|
_ => 0,
|
||||||
|
};
|
||||||
|
bool isWin = HitButton(true, timing);
|
||||||
if (isWin) {
|
if (isWin) {
|
||||||
if (rollingSound != null) rollingSound.Stop();
|
if (rollingSound != null) rollingSound.Stop();
|
||||||
smAnim.DoScaledAnimationAsync("Win", 0.5f);
|
smAnim.DoScaledAnimationAsync("Win", 0.5f);
|
||||||
|
@ -270,11 +287,6 @@ namespace HeavenStudio.Games
|
||||||
if (state is >= 1f or <= -1f) SoundByte.PlayOneShot("nearMiss");
|
if (state is >= 1f or <= -1f) SoundByte.PlayOneShot("nearMiss");
|
||||||
}
|
}
|
||||||
|
|
||||||
// private void ButtonMiss(PlayerActionEvent caller)
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void ButtonColor(Color[] colors, Color flashColor)
|
public void ButtonColor(Color[] colors, Color flashColor)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buttons.Length; i++) {
|
for (int i = 0; i < buttons.Length; i++) {
|
||||||
|
|
|
@ -433,16 +433,6 @@ namespace HeavenStudio
|
||||||
Debug.LogWarning("Game loader NtrSlotMonsterLoader failed!");
|
Debug.LogWarning("Game loader NtrSlotMonsterLoader failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
game = NtrSlotMonsterLoader.AddGame(eventCaller);
|
|
||||||
if (game != null)
|
|
||||||
{
|
|
||||||
eventCaller.minigames.Add(game.name, game);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogWarning("Game loader NtrSlotMonsterLoader failed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
game = AgbGhostLoader.AddGame(eventCaller);
|
game = AgbGhostLoader.AddGame(eventCaller);
|
||||||
if (game != null)
|
if (game != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue