2023-02-21 16:42:21 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Scripts_SneakySpirits
|
|
|
|
{
|
|
|
|
public class SneakySpiritsGhostDeath : MonoBehaviour
|
|
|
|
{
|
|
|
|
public string animToPlay;
|
2023-06-10 19:17:06 +00:00
|
|
|
public double startBeat;
|
2023-02-21 16:42:21 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|