コード例 #1
0
    void Update()
    {
        float Score = ScoreM.GetComponent <ScoringManager>().Score;


        /*if(Round % 4 == 0 && UpgradeAvailable == true)
         * {
         *  UpgradeManager.SetActive(true);
         *  UpgradeAvailable = false;
         * }*/


        if (CurrentTimer >= 0 && StartTheTimer == true)
        {
            CurrentTimer -= Time.deltaTime;
        }


        if (CurrentTimer <= 0 && EnemySpawner.CurrentEnemies == 1f)
        {
            CurrentTimer  = Timer;                       //Reset Timer
            StartTheTimer = false;
            StartCoroutine(EnemySpawner.SpawnAnEnemy()); //Spawn Enemies
        }



        if (Score % EnemiesKilledToSpawn == 0 && SpawnedBoss == false)     // if round is a multiple of 2      Round % 2 == 0
        {
            EnemiesKilledWhenBossIsSpawned = Score;
            if (CanStartRound == true)
            {
                Round++;
                DisplayRound();
                EnemySpawner.BossRound();
                CanStartRound = false;
            }
            SpawnedBoss = true;
        }
        else if (Score % 10 == 0)  //If score is a multiple of max enemies (10)         Score % EnemySpawner.MaxEnemies == 0
        {
            if (CanStartRound == true)
            {
                RoundStart();
                CanStartRound = false;
            }
        }
        if (Score % 10 != 0)
        {
            CanStartRound = true;
        }
        if (Score > EnemiesKilledWhenBossIsSpawned)
        {
            SpawnedBoss = false;
        }
    }