void Start() { Camera cam = Camera.main; float height = 2f * cam.orthographicSize; float width = height * cam.aspect; IRectangle boundary = new Rectangle((int)-width / 2, (int)-height / 2, (int)width, (int)height); Debug.Log(height); quadTree = new QuadTree(4, boundary); userObjectSpawner = new DefaultUserObjectSpawner(boundary); insertQuadTreeVisitor = new InsertQuadTreeVisitor(1, userObjectSpawner); debugRenderingQuadTreeVisitor = new DebugRenderingQuadTreeVisitor(); userObjectSpawner.SetUpperSpawnLimit(1000); userObjectSpawner.SetObjectInitialHealth(5); }
void Init() { waitForObjectCreation = new WaitForSecondsRealtime(objectCreatePeriod); Camera cam = Camera.main; float height = 2f * cam.orthographicSize; float width = height * cam.aspect; IRectangle boundary = new Rectangle(-width / 2, -height / 2, width, height); quadTree = new QuadTree(4, boundary); userObjectSpawner = new DefaultUserObjectSpawner(boundary, prefabCircle, prefabRectangle); insertQuadTreeVisitor = new InsertQuadTreeVisitor(1, userObjectSpawner); debugRenderingQuadTreeVisitor = new DebugRenderingQuadTreeVisitor(); userObjectSpawner.SetUpperSpawnLimit(PlayerPrefs.GetInt("NumberOfEntities")); userObjectSpawner.SetObjectInitialHealth(PlayerPrefs.GetInt("InitialHealth")); suitableForSpawn = true; Selection.activeGameObject = gameObject; }