mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-23 10:05:14 +00:00
884a5bc401
* Started, off to a good start * Animation shit * I hope this looks okay * expose song pitch to minigames * clean up new additions * They now lower down * Da new pitch stuff needs update but I made cool stuff regardless * Hit sprites implemented * Added barely animation for ghost * Missing and barely stuff implemented * make new functions actually set music pitch * Bow enter or exit --------- Co-authored-by: minenice55 <star.elementa@gmail.com>
36 lines
905 B
C#
36 lines
905 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Games.Scripts_SneakySpirits
|
|
{
|
|
public class SneakySpiritsGhostDeath : MonoBehaviour
|
|
{
|
|
public string animToPlay;
|
|
public float startBeat;
|
|
public float length;
|
|
[SerializeField] Animator anim;
|
|
|
|
void Awake()
|
|
{
|
|
anim = GetComponent<Animator>();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
var cond = Conductor.instance;
|
|
if (cond.isPlaying && !cond.isPaused)
|
|
{
|
|
float normalizedBeat = Mathf.Max(cond.GetPositionFromBeat(startBeat, length), 0f);
|
|
anim.DoNormalizedAnimation(animToPlay, normalizedBeat);
|
|
if (normalizedBeat > 1)
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|