// Start is called before the first frame update void Start() { entitiy = GetComponent <Entity2D>(); if (entitiy == null) { movingSolid = GetComponent <MoveingSolid>(); if (movingSolid == null) { Debug.LogWarning("Object : " + gameObject.name + " needs and Entity2D or MoveingSolid to use EntityFollowAlongPath."); } } initPos = transform.position; float inc = (Mathf.PI * 2.0f) / Percision; float cur = 0; for (int i = 0; i <= Percision; i++) { cur += inc; Vector2 newPos = new Vector2(Mathf.Cos(cur), Mathf.Sin(cur)) * Radius; pointPositions.Add((Vector2)initPos + newPos); } listIndex = listIndex % Percision; transform.position = pointPositions[listIndex]; Speed = Speed * Physics2DExtra.PIXEL_UNIT; }
// Start is called before the first frame update void Start() { entitiy = GetComponent <Entity2D>(); if (entitiy == null) { movingSolid = GetComponent <MoveingSolid>(); if (movingSolid == null) { Debug.LogWarning("Object : " + gameObject.name + " needs and Entity2D or MoveingSolid to use EntityFollowAlongPath."); } } speed = speed * Physics2DExtra.PIXEL_UNIT; }