GameObject SpawnObject(Vector3 position) { GameObject spawnedObj = Instantiate(spawnObjectPrefab, position, Quaternion.identity) as GameObject; if (spawnedObjectParent != null) { spawnedObj.transform.SetParent(spawnedObjectParent); } _cooldownTimer = cooldown; _currNumObjects++; AutoSpawnedObject aso = spawnedObj.AddComponent <AutoSpawnedObject>(); aso.autoSpawner = this; return(spawnedObj); }
void IAutoSpawner.OnSpawnedObjectDestroy(AutoSpawnedObject spawnedObj) { _currNumObjects--; }