// Update is called once per frame void Update() { // checks to see if the spawner is enabled. if (spawnerEnabled) { // countdown to spawn another item. spawnCountdown -= Time.deltaTime; // another itme should be spawned. if (spawnCountdown <= 0.0F) { spawnCountdown = 0.0F; // if there are items in the pool, then something can be spawned. if (!itemManager.ItemPoolIsEmpty()) { spawnCountdown = spawnTime; // randomizes the position FieldItem newItem = itemManager.GetItem(); newItem.RandomizePosition(spawnAreaMin, spawnAreaMax); newItem.useDespawnTimer = autoItemDespawn; } } } }