using UnityEngine; using System.Collections; public class CirclePathController : MonoBehaviour { public Vector3 center; public float radius; public int speed; private int degree; void Start() { InvokeRepeating("TestInvoke", 0, 0.03f); } void Update() { } void TestInvoke() { UnityEngine.Profiling.Profiler.BeginSample("TestInvoke"); int _realIndex = Mathf.Abs(degree % 360); float _x = center.x + GeometryConstant.COS_ANGLE_VALUE[_realIndex] * radius; float _z = center.z + GeometryConstant.SIN_ANGLE_VALUE[_realIndex] * radius; transform.position = new Vector3(_x, center.y, _z); degree += speed; if (degree > 359) degree = 0; else if (degree < 0) degree = 359; UnityEngine.Profiling.Profiler.EndSample(); } }