Files
BlueArchiveMiniGame/Assets/ThirdParty/DestroyIt/Demos (safe to delete)/Scripts/Effects/FloatUp.cs
2025-09-17 18:56:28 +08:00

32 lines
848 B
C#

using UnityEngine;
namespace DestroyIt
{
public class FloatUp : MonoBehaviour
{
[Range(0f, 10f)]
public float floatSpeed = 5f;
private float checkFrequency = 0.05f; // The time (in seconds) this script checks for updates.
private float nextUpdateCheck;
// Use this for initialization
void Start()
{
nextUpdateCheck = Time.time + checkFrequency;
}
// Update is called once per frame
void Update()
{
if (Time.time > nextUpdateCheck)
{
// float up
this.gameObject.transform.position = this.gameObject.transform.position + (Vector3.up * floatSpeed);
// reset the counter
nextUpdateCheck = Time.time + checkFrequency;
}
}
}
}