public void spawn() { if (spawnTimer <= 0) { track = Random.Range(0, 10); float uAngleD = track * 36; float speed = Random.Range(minSpeed, maxSpeed); float vAngleD = initialAngle; GameObject product = ((TorusMover)factory.produce()).gameObject; GameObject go = Instantiate(product, new Vector3(0f, 0f, 0f), Quaternion.identity); TorusMover tm = go.GetComponent <TorusMover>(); tm.uAngleD = uAngleD; tm.speed = speed; tm.vAngleD = vAngleD; tm.torusRadius = torusRadius; tm.innerRadius = innerRadius; tm.killAngle = killAngle; go.GetComponent <TorusMover>().kill += removeCollectible; collectibles.Add(go); spawnTimer = timeBetweenSpawns; } else { spawnTimer -= Time.deltaTime; } }
public void manualSpawn(float uAngleD, float vAngleD, int type) { float speed = Random.Range(minSpeed, maxSpeed); GameObject product = ((TorusMover)factory.produceManual(type)).gameObject; GameObject go = Instantiate(product, new Vector3(0f, 0f, 0f), Quaternion.identity); TorusMover tm = go.GetComponent <TorusMover>(); tm.uAngleD = uAngleD; tm.speed = speed; tm.vAngleD = vAngleD; tm.torusRadius = torusRadius; tm.innerRadius = innerRadius; tm.killAngle = killAngle; tm.updateOffset(); go.GetComponent <TorusMover>().kill += removeCollectible; collectibles.Add(go); }