Пример #1
0
    private void AttemptToSpawnEnemy()
    {
        int enemySpawnChance = securityLevel;

        if (enemyHindrance > 0)
        {
            Debug.Log("Enemy percent spawn hindrance");
            enemySpawnChance -= enemyHindrance;
            if (enemySpawnChance < 5)
            {
                // We cap the reductions to spawn chance at 5% for now...
                enemySpawnChance = 5;
            }
            enemyHindrance--;
        }

        if (Random.Range(0, 100) <= enemySpawnChance)
        {
            // WRAP THIS IN A % CHANCE CHECK
            if (enemySpawnBlock > 0)
            {
                enemySpawnBlock--;
                Debug.Log("Blocked spawning an enemy");
            }
            else
            {
                Debug.Log("Spawn an Enemy");
                mapGrid.AttemptToSpawnAnEnemy(securityLevel);
                // TODO: Spawn an enemy?
            }
        }
        else
        {
            Debug.Log("Enemy spawn failed...");
        }
    }