void Die() { healthPercent = currentHP / maxHP; if (this.name == "Dethros(Clone)" || this.name == "Dethros" || this.name == "Lorne(Clone)" || this.name == "Lorne" || this.name == "Morrius(Clone)" || this.name == "Morrius") { Instantiate(BossDeathParticles, this.transform.position, new Quaternion(0, 0, 0, 0)); this.SendMessage("DestroyHealthBar", SendMessageOptions.DontRequireReceiver); if (this.name == "Morrius(Clone)" || this.name == "Morrius") { theoptions.MorriusDie(); if (playerHealth.currentHP >= playerHealth.maxHP) { theoptions.FullHp(); } } else if (this.name == "Lorne(Clone)" || this.name == "Lorne") { theoptions.LorneDie(); if (playerHealth.currentHP >= playerHealth.maxHP) { theoptions.FullHp(); } } else if (this.name == "Dethros(Clone)" || this.name == "Dethros") { theoptions.DethrosDie(); if (playerHealth.currentHP >= playerHealth.maxHP) { theoptions.FullHp(); } } } if (this.tag != "Player") { theoptions.AddToEnemy(); if (this.GetComponent <AICommander>() != null) { this.GetComponent <AICommander>().commandercount -= 1; // this.GetComponent<AICommander>().UnReinforcing(); } Instantiate(lightRemains, transform.position, transform.rotation); Instantiate(corpse, new Vector3(transform.position.x, transform.position.y, -0.5f), Quaternion.identity); gameObject.GetComponent <GenerateLoot>().Generateloot(); if (isInfected) { Explode(); } if (GetComponent <Reinforced>() != null) { Destroy(GetComponent <Reinforced>().temp); } Destroy(this.gameObject); if (generator != null) { --generator.finalRoomInfoArray[generator.currentRoom].numEnemies; } } else { if (playerDead) { GameObject.FindObjectOfType <Options>().GetComponent <Options>().DieAchv(); anim.CrossFade("Dying", 0.01f); GameObject.FindObjectOfType <BGM>().SendMessage("SetToMenu", SendMessageOptions.DontRequireReceiver); // GameObject.FindObjectOfType<BGM>().audioPlayer.Stop(); GameObject.FindObjectOfType <Options>().GetComponent <SaveTest>().YOUDIED(); player.GetComponent <AudioSource>().PlayOneShot(loseSound); equipment.paused = true; playerDead = true; Instantiate(LoseText); } } }