示例#1
0
    void scheduleNextEnemySpawn()
    {
        float spawnInSeconds;

        if (maxSpawnRateInSeconds > 0.5f)
        {
            spawnInSeconds = Random.Range(0.5f, maxSpawnRateInSeconds);
        }
        else
        {
            spawnInSeconds = 0.5f;
        }

        if (enemyCounter >= maximum)
        {
            CancelInvoke("spawnEnemy");
            SpawnBoss.comeOut(boss);
        }
        else
        {
            Invoke("spawnEnemy", spawnInSeconds);
        }
    }