// Use this for initialization public override void AgentReset() { float x, y; x = Random.Range(map.BottomLeft.x, map.TopRight.x); y = Random.Range(map.BottomLeft.y, map.TopRight.y); while ((new Vector3(x, y, transform.localPosition.z) - map.GetOpponent(gameObject).transform.localPosition).magnitude < map.TopRight.magnitude / 1.25f) { x = Random.Range(map.BottomLeft.x, map.TopRight.x); y = Random.Range(map.BottomLeft.y, map.TopRight.y); } transform.localPosition = new Vector3(x, y, transform.localPosition.z); foreach (var p in projectiles) { if (p != null && p.Creator == this) { p.Disable(); } } projectiles.Clear(); startTime = Time.unscaledTime; rigid.velocity = Vector2.zero; }