mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-26 19:43:01 +00:00
11c1ae8f50
* Made Nail half-speed, changed long nail from hold B to press B, touched up animations - Made Nail Carpenter half-speed -- it shouldn't change much, just remember to double your tempo! - Also changed the long nail input from hold and release to simply pressing B -- the old way gives less reaction time and is just less fun overall - Also touched up the animations to make them snappier and improve gamefeel * Cleaned up animations a bit further, changed 'fusuma' to 'shoji' * Further animation improvements Hit animations are now instant, and the hammer animation is about snappy and responsive as it should be * Fixed touch controls FIxed touch controls being a miss no matter what * reimplemented touch mode whiffing cuz i forgor * fixed a sound effect playing at the wrong time * spawning logic overhaul also fixed issue where sweets would be hittable if a nail could be instead cues at full speed for testing need to halve the speed of everything later * remove stray sfx call * add missing exclaim animations to the forced object types * improve chunk based spawning improve animator setup * remove unused stuff * new animations girl randomly blinks puddings bounce when passing the girl nails pop out when missing * fix the sweet break check --------- Co-authored-by: minenice55 <star.elementa@gmail.com>
123 lines
No EOL
3.7 KiB
C#
123 lines
No EOL
3.7 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_NailCarpenter
|
|
{
|
|
public class Sweet : MonoBehaviour
|
|
{
|
|
public double targetBeat;
|
|
public float targetX;
|
|
public float metresPerSecond;
|
|
public sweetsType sweetType;
|
|
public Animator sweetAnim;
|
|
|
|
bool broken = false;
|
|
|
|
public enum sweetsType
|
|
{
|
|
None = -1,
|
|
Pudding = 0,
|
|
CherryPudding = 1,
|
|
ShortCake = 2,
|
|
Cherry = 3,
|
|
LayerCake = 4,
|
|
};
|
|
|
|
private NailCarpenter game;
|
|
|
|
public void Init()
|
|
{
|
|
game = NailCarpenter.instance;
|
|
broken = false;
|
|
|
|
AwakeAnim();
|
|
game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_SweetsHit, HammmerJust, null, null);
|
|
Update();
|
|
|
|
if (sweetType == sweetsType.Pudding)
|
|
{
|
|
BeatAction.New(this, new List<BeatAction.Action>()
|
|
{
|
|
new BeatAction.Action(targetBeat, delegate
|
|
{
|
|
if (!broken)
|
|
{
|
|
sweetAnim.Play("puddingBeat", -1, 0);
|
|
}
|
|
})
|
|
});
|
|
}
|
|
}
|
|
|
|
private void AwakeAnim()
|
|
{
|
|
switch (sweetType)
|
|
{
|
|
case sweetsType.Pudding:
|
|
sweetAnim.Play("puddingIdle", -1, 0);
|
|
break;
|
|
case sweetsType.CherryPudding:
|
|
sweetAnim.Play("cherryPuddingIdle", -1, 0);
|
|
break;
|
|
case sweetsType.ShortCake:
|
|
sweetAnim.Play("shortCakeIdle", -1, 0);
|
|
break;
|
|
case sweetsType.Cherry:
|
|
sweetAnim.Play("cherryIdle", -1, 0);
|
|
break;
|
|
case sweetsType.LayerCake:
|
|
sweetAnim.Play("layerCakeIdle", -1, 0);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void BreakAnim()
|
|
{
|
|
broken = true;
|
|
switch (sweetType)
|
|
{
|
|
case sweetsType.Pudding:
|
|
sweetAnim.DoScaledAnimationAsync("puddingBreak", 0.25f);
|
|
break;
|
|
case sweetsType.CherryPudding:
|
|
sweetAnim.DoScaledAnimationAsync("cherryPuddingBreak", 0.25f);
|
|
break;
|
|
case sweetsType.ShortCake:
|
|
sweetAnim.DoScaledAnimationAsync("shortCakeBreak", 0.25f);
|
|
break;
|
|
case sweetsType.Cherry:
|
|
sweetAnim.DoScaledAnimationAsync("cherryBreak", 0.25f);
|
|
break;
|
|
case sweetsType.LayerCake:
|
|
sweetAnim.DoScaledAnimationAsync("layerCakeBreak", 0.25f);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void HammmerJust(PlayerActionEvent caller, float state)
|
|
{
|
|
game.ScoreMiss();
|
|
BreakAnim();
|
|
game.Carpenter.DoScaledAnimationAsync("eyeBlink", 0.25f, animLayer: 1);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
var cond = Conductor.instance;
|
|
|
|
if (cond.isPlaying && !cond.isPaused)
|
|
{
|
|
double beat = cond.songPositionInBeats;
|
|
Vector3 pos = transform.position;
|
|
pos.x = targetX + (float)((beat - targetBeat) * metresPerSecond);
|
|
transform.position = pos;
|
|
if (targetBeat != double.MinValue)
|
|
{
|
|
if (beat >= targetBeat + 9) Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |