HeavenStudioPlus/Assets/Scripts/Games/WorkingDough/NPCDoughBall.cs

39 lines
1 KiB
C#
Raw Normal View History

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 NPCDoughBall : SuperCurveObject
{
2023-06-12 12:04:32 +00:00
private double startBeat = double.MinValue;
private Path path;
2023-06-12 12:04:32 +00:00
public void Init(double beat)
{
startBeat = beat;
path = WorkingDough.instance.GetPath("NPCBall");
Update();
}
private void Update()
{
var cond = Conductor.instance;
2023-06-12 12:04:32 +00:00
if (cond.isPlaying && !cond.isPaused)
{
double beat = cond.songPositionInBeats;
if (startBeat > double.MinValue)
{
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, startBeat), startBeat);
transform.position = pos;
if (beat >= startBeat + 2) Destroy(gameObject);
}
}
}
}
}