mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 05:35:08 +00:00
e6ca67b4de
* slot monster GO!
* Rearrangement
+ work on prep anim
* A bit more anim work
* oops
* oops! again!
* grayscale buttons
* basic code + sfx
huzzah!
* bg
* unassigned animation clip, oops
* basic logic, sfx
🤩
* more anim stuff
slowly
* tweaks
no the bounce on the release anim isnt done that crap is way too elastic rn
* icon
* eye sprites!! ill do more later
* baby's first text changes
* push before i revert the prepare
* flash/inputs actually working, create SlotButton.cs
flash now lerps in the SlotButton class, which makes things so. so much easier.
* coin pile,,,
(+ some tweaked anims, may further tweak)
* test block is kil
oops
* slight eyes rework + early barely anims
kill
* fixed eye 3
i am foolish
* eye barelies, consecutive c&rs
we're so close!
* reimport spritesheet
goodbye spritesheet weirdness
* Revert "reimport spritesheet"
This reverts commit f7bd24d14970467fc85a806b60b0fdb9b51b437d.
* okay reimported for realsies this time
* lose anim + larger coins
* I'm stupid + button tweaks
* READY FOR RECORDING
particles, win animation, etc.
* fix particles
* so close to being done :(( but weird input bug
* cleaning up
fix some bugs, add some stuff. this is almost ready for pr!!
* ITS DONE... FINALLY DONE...
* oops star tweak
* ass buns
---------
Co-authored-by: Seanski2 <seanbenedit@gmail.com>
95 lines
2.7 KiB
C#
95 lines
2.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
using UnityEngine.Playables;
|
|
|
|
namespace HeavenStudio.Games.Scripts_SlotMonster
|
|
{
|
|
public class SlotButton : MonoBehaviour
|
|
{
|
|
public bool pressed;
|
|
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;
|
|
[SerializeField] SpriteRenderer[] srs;
|
|
|
|
private bool flashing;
|
|
private const float FLASH_FRAMES = 4f;
|
|
private int currentFrame;
|
|
|
|
private SlotMonster game;
|
|
|
|
public void Init(SlotMonster instance)
|
|
{
|
|
game = instance;
|
|
pressed = true;
|
|
color = srs[0].color;
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
Color newColor = color;
|
|
if (pressed) {
|
|
newColor = Color.LerpUnclamped(color, Color.black, 0.5f);
|
|
} else if (flashing) {
|
|
float normalized = currentFrame / FLASH_FRAMES;
|
|
|
|
Debug.Log("normalized : " + normalized);
|
|
float newR = EasingFunction.Linear(game.buttonFlashColor.r, color.r, normalized);
|
|
float newG = EasingFunction.Linear(game.buttonFlashColor.g, color.g, normalized);
|
|
float newB = EasingFunction.Linear(game.buttonFlashColor.b, color.b, normalized);
|
|
|
|
newColor = new Color(newR, newG, newB);
|
|
// Debug.Log("currentFrame / FLASH_FRAMES : " + currentFrame + "/" + FLASH_FRAMES);
|
|
// newColor = Color.LerpUnclamped(color, game.buttonFlashColor, normalized);
|
|
// Debug.Log("color : " + color);
|
|
// Debug.Log("newColor : " + newColor);
|
|
}
|
|
|
|
foreach (var sr in srs) {
|
|
sr.color = newColor;
|
|
}
|
|
}
|
|
|
|
public void Ready()
|
|
{
|
|
anim.Play("PopUp", 0, 0);
|
|
pressed = false;
|
|
flashing = false;
|
|
missed = false;
|
|
}
|
|
|
|
public void Press(bool isMiss)
|
|
{
|
|
anim.DoScaledAnimationAsync("Press", 0.5f);
|
|
pressed = true;
|
|
flashing = false;
|
|
missed = isMiss;
|
|
if (isMiss && input != null) {
|
|
input.Disable();
|
|
input.CleanUp();
|
|
}
|
|
}
|
|
|
|
public void TryFlash()
|
|
{
|
|
if (!pressed) {
|
|
anim.DoScaledAnimationAsync("Flash", 0.5f);
|
|
}
|
|
}
|
|
|
|
// animation events
|
|
public void AnimateColor(int frame)
|
|
{
|
|
currentFrame = frame;
|
|
flashing = frame < FLASH_FRAMES;
|
|
}
|
|
}
|
|
}
|