Esempio n. 1
0
 void Start()
 {
     colliders         = GetComponentsInChildren <BoxCollider>();
     currentDifficulty = EnemyGlobalSettings.GetDifficulty();
     SpawnAll();
     StartCoroutine(Respawn());
 }
Esempio n. 2
0
    IEnumerator Respawn()
    {
        yield return(new WaitForSeconds(Random.Range(3.0f, 6.0f)));

        if (EnemyGlobalSettings.GetDifficulty() != currentDifficulty)
        {
            currentDifficulty = EnemyGlobalSettings.GetDifficulty();
            RemoveAll();
            SpawnAll();
        }
        else if (Vector3.Distance(transform.position, PlayerMovement.instance.transform.position) > 3.0f)
        {
            SpawnAll();
        }
        StartCoroutine(Respawn());
    }