Ejemplo n.º 1
0
	// Use this for initialization
	void Start () {

		//this.npc = GameObject.FindGameObjectWithTag ("Enemy");
		if(this.npc.tag == "Boss"){
			this.boss = (Movement)this.npc.GetComponent<Movement> ();
			this.resize_health = Mathf.Pow(this.boss.getAttributes().getHealth() / this.boss.getAttributes().getMaxHealth(), -1);
		}else if(this.npc.tag == "Enemy"){
			this.enemy = (Movement_graveler)this.npc.GetComponent<Movement_graveler> ();
			this.resize_health = Mathf.Pow(this.enemy.getAttributes().getHealth() / this.enemy.getAttributes().getMaxHealth(), -1);
		}

		
		// ADD TEXTURES
		this.HealthTexture = Resources.Load<Texture2D>("NPC/NPCbar_health");
		this.HealthBarTexture = Resources.Load<Texture2D>("NPC/NPCbar");

		this.health = 0f;
		
	}
Ejemplo n.º 2
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);
			}
		}
	}