void Die() { gameObject.GetComponent <MobHealthBar>().hurt = false; healthbar.transform.position = new Vector3(0, -1000, 0); bool flag = false; gameObject.GetComponent <BoxCollider2D>().enabled = false; if (gameObject.TryGetComponent <CircleCollider2D>(out CircleCollider2D collider2D) == true) { gameObject.GetComponent <CircleCollider2D>().enabled = false; } gameObject.GetComponent <Animator>().SetBool("Death", true); if (TryGetComponent <NecrBehaviour>(out NecrBehaviour necrBehaviour)) { Destroy(necrBehaviour); } else if (TryGetComponent <Elemental_behaviour>(out Elemental_behaviour elemental_Behaviour)) { Destroy(elemental_Behaviour); } else if (TryGetComponent <AcientBehaviour>(out AcientBehaviour acientBehaviour)) { Destroy(acientBehaviour); flag = true; } Destroy(rb); Destroy(hb); Destroy(hbb); //GameObject ml = new GameObject(); List <GameObject> Loot = new List <GameObject>(); Loot = lootManager.GetGearForBoss(); //GameObject bl = new GameObject(); //Loot.Add(lootManager.GetRandomGear()); //ml = Loot[0]; //while (i < 2) //{ // bl = lootManager.GetRandomGear(); // //Loot.Add(bl); // if (bl != ml) // { // Loot.Add(bl); // ml = bl; // i++; // } // Debug.Log("UHNUIHUHJOPJHNOI"); //} if (!flag) { Instantiate(Loot[0], transform.position + (transform.right * -0.5f), Quaternion.identity); Instantiate(Loot[1], transform.position + (transform.right * -0.5f), Quaternion.identity); Instantiate(Loot[2], transform.position + (transform.right * -0.5f), Quaternion.identity); } else if (flag) { } }