2023-01-19 17:18:55 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using NaughtyBezierCurves;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
|
|
|
|
namespace HeavenStudio.Games.Scripts_WorkingDough
|
|
|
|
{
|
2023-06-12 12:04:32 +00:00
|
|
|
public class BGBall : SuperCurveObject
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
2023-06-12 12:04:32 +00:00
|
|
|
private double startBeat = double.MinValue;
|
|
|
|
private Path path;
|
|
|
|
|
|
|
|
public void Init(double beat)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
2023-06-12 12:04:32 +00:00
|
|
|
startBeat = beat;
|
|
|
|
path = WorkingDough.instance.GetPath("BGBall");
|
|
|
|
Update();
|
2023-01-19 17:18:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
|
|
|
var cond = Conductor.instance;
|
|
|
|
|
2023-06-12 12:04:32 +00:00
|
|
|
if (cond.isPlaying && !cond.isPaused)
|
2023-01-19 17:18:55 +00:00
|
|
|
{
|
2023-06-12 12:04:32 +00:00
|
|
|
double beat = cond.songPositionInBeats;
|
|
|
|
if (startBeat != double.MinValue)
|
|
|
|
{
|
|
|
|
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(startBeat, beat), startBeat);
|
|
|
|
transform.position = pos;
|
|
|
|
if (beat >= startBeat + 9) Destroy(gameObject);
|
|
|
|
}
|
2023-01-19 17:18:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|