//Choose and spawn the next object private void SpawnNewObject() { Vector3 spawnPosition = new Vector3(); spawnPosition.x = gameObject.transform.position.x; spawnPosition.y = gameObject.transform.position.y + Random.Range(-5.0f, 5.0f); spawnPosition.z = gameObject.transform.position.z; ObjectPoolScript_.SetObject(ChosenObstacle, spawnPosition); }
//Choose and spawn the next object private void SpawnNewObject() { if (obstaclesLeft < 3) { asteroidSpawner.state = AsteroidSpawner.State.Passive; Debug.Log("passive"); } if (obstaclesLeft > 0 && shouldSpawnObject == true) { ThreeSigmaRule(); ObjectPoolScript_.SetObject(ChosenObstacle, gameObject.transform.position); obstaclesLeft--; } else if (obstaclesLeft <= 0 && ZoneScript.m_still_playing) { ZoneScript.NextZone(); shouldSpawnObject = false; } }