コード例 #1
0
	//Comprueba si los enemigos de la lista estan muertos
	void isAllEnemysDead(){
		
		//Contador para saber el numero de enemigos muertos.
		int cont = 0;
		if(this.npc_enemy != null && this.npc_boss != null && this.allDead == false){
			if(this.npc_boss.tag == "Boss"){
				this.boss = this.npc_boss.GetComponent<Movement> ();
				if(boss.getAttributes().getHealth() <= 0.0f){
					//Destroy(npc_boss);
					npc_boss = null;
				}
			}
			
			///Miramos los NPC
			for(int i = 0; i < npc_enemy.Length; i++){
				if(this.npc_enemy[i] != null && this.npc_enemy[i].tag == "Enemy"){
					this.enemy = this.npc_enemy[i].GetComponent<Movement_graveler> ();
					if(this.enemy != null && enemy.getAttributes().getHealth() <= 0.0f){
						//Destroy(npc_enemy[i]);
						npc_enemy[i] = null;
						cont += 1;
					}
				} else {
					cont += 1;
				}
			}
			
			if(cont == npc_enemy.Length){
				Destroy(GameObject.FindGameObjectWithTag("FireWall_bridge"));
			}
		}
		
		if (this.npc_boss == null) {
			
			delay -= 1 * Time.deltaTime;
			
			if(delay <= 0){
				allIsDead = true;
				this.camera2.SetActive(true);
			}
		}
	}