// Update is called once per frame void Update() { //both Bunny and Cat have a function isSpawn, but is only declared in the Bunny class. //Cat inherits this function since it is virtual. isSpawn is a random number generator //to determine if we should spawn the object yet or not. if (c1.isSpawn(numOfObjects, spawnSpeed)) { //rand is a random value on the x-axis to make the particle fall more natural randx = Random.Range(0, 16); randy = Random.Range(0, 16); //instantiate whatever object we are at in the iterator objs[i] = Instantiate(obj, new Vector2(randx, randy), transform.rotation); //cat has a different spawnBun function than bunny, so it is static in bunny //spawnBun either makes the sprite spawned a bunny or a cat c1.spawnBun(objs[i]); //use the iterator next function i = SydneyIterate.next(); } }