IEnumerator Spawn()
    {
        while (true)
        {
            if (!distanceController.checkBossStage())
            {
                if (!enemyOnField)
                {
                    enemyOnField = true;
                    yield return(new WaitForSeconds(0.5f));

                    SetEnemyGroup(distanceController.GetStage());
                    rand = Random.Range((0 + stageOffset), (9 + stageOffset));
                    if (enemyGroup[rand] != null)
                    {
                        createdGroup = Instantiate(enemyGroup[rand], transform.position, Quaternion.identity) as GameObject;
                    }
                }

                if (GameObject.FindWithTag("Enemy") == null)
                {
                    Destroy(createdGroup);
                    enemyOnField = false;
                }
            }
            yield return(new WaitForSeconds(0.1f));
        }
    }
 // Update is called once per frame
 void Update()      //update states
 {
     if (distanceController.checkBossStage() && !bossSpawned)
     {
         m_CurrentState.Enter();
         bossSpawned = true;
     }
 }
Esempio n. 3
0
 void Update()
 {
     if (distCont.checkBossStage() && !bossSpawned)
     {
         nextState.Enter();
         bossSpawned = true;
     }
 }
Esempio n. 4
0
 void Update()
 {
     // check if player is on boss stage
     if (distanceController.checkBossStage() && !bossSpawned)
     {
         nextState.Enter();
         bossSpawned = true;
     }
 }
    void Update()
    {
        if ( (distanceController.checkBossStage()) || (properties.getAmmo() <= 0 && properties.getAmmo() != -99) )
        {
            Invoke("Remove", 1.0f);
            if (!isDespawning)
                isDespawning = true;
        }

        if (myTransform.position.y >= 14 && isDespawning)
            Destroy(gameObject);
    }