public void changeAttack(string attack) { if (!attack.Equals(this.attack.ToString())) { this.attack = AttackInit.generateAttack(attack); } }
void Awake() { health = GetComponent <BossHealth>(); timeDecided = false; attack = new PrimeraFase(anims); active = false; attack2 = new SegonaFase(trf, cols); }
private void bossState(float health) { if (health <= 75 && health > 50) { attack = attack2; foreach (GameObject plat in GameObject.FindGameObjectsWithTag("PlatF2")) { plat.GetComponent <BoxCollider2D>().enabled = true; } foreach (GameObject plat in GameObject.FindGameObjectsWithTag("PlatF2")) { plat.GetComponent <PlatformFades>().InvokeRepeating("fadeIn", 0, 0.1f); } } else if (health == 50) { transform.position = tpPosition.position; GameObject.FindGameObjectWithTag("darkness").GetComponent <DarknessFollows>().enabled = true; GameObject.FindGameObjectWithTag("darkness").GetComponent <BoxCollider2D>().enabled = true; GameObject.FindGameObjectWithTag("darkness").GetComponent <DarknessFades>().InvokeRepeating("fadeIn", 0, 0.1f); GameObject.FindGameObjectWithTag("darknessEnlarger").GetComponent <DarknessFades>().InvokeRepeating("fadeIn", 0, 0.1f); GameObject.FindGameObjectWithTag("PlatF3").GetComponent <BoxCollider2D>().enabled = true; GameObject.FindGameObjectWithTag("PlatF3").GetComponent <PlatformFades>().InvokeRepeating("fadeIn", 0, 0.1f); } else if (health >= 25 && health < 50) { GameObject.FindGameObjectWithTag("darkness").GetComponent <DarknessFollows>().enabled = false; GameObject.FindGameObjectWithTag("darkness").GetComponent <BoxCollider2D>().enabled = false; GameObject.FindGameObjectWithTag("darkness").GetComponent <DarknessFades>().InvokeRepeating("fadeOut", 0, 0.1f); GameObject.FindGameObjectWithTag("darknessEnlarger").GetComponent <DarknessFades>().InvokeRepeating("fadeOut", 0, 0.1f); changeAttack("TerceraFase"); } else if (health < 25) { changeAttack("LastFase"); smashTheButton(); } }