30 lines
574 B
C#
30 lines
574 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace EnergyBarToolkit
|
|
{
|
|
public class GoCircles : MonoBehaviour
|
|
{
|
|
public float distance = 3f;
|
|
|
|
public float speed = 100f;
|
|
|
|
private Vector3 startPosition;
|
|
|
|
private float angle;
|
|
|
|
private void Start()
|
|
{
|
|
startPosition = base.transform.position;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
float x = Mathf.Cos((float)Math.PI / 180f * angle) * distance;
|
|
float z = Mathf.Sin((float)Math.PI / 180f * angle) * distance;
|
|
base.transform.position = startPosition + new Vector3(x, 0f, z);
|
|
angle += Time.deltaTime * speed;
|
|
}
|
|
}
|
|
}
|