public override void Die() { for (int i = 0; i < DropTable.Length; i++) { if (UnityEngine.Random.value < DropTable[i].DropChancePercent / 100.0f) { var drop = Instantiate(DropTable[i].DropPrefab, Pivot.transform.position, Quaternion.identity); drop.GetComponent <Rigidbody>().velocity = UnityEngine.Random.insideUnitSphere * 5.0f; DropChance.ResetMultiplier(); } } var particle = GetComponentInChildren <ParticleSystem>(); if (particle) { particle.transform.SetParent(null, true); particle.transform.position = Pivot.transform.position; particle.transform.rotation = Pivot.transform.rotation; particle.transform.localScale = Pivot.transform.lossyScale; particle.Emit(100); GameObject.Destroy(particle.gameObject, 2.0f); } Destroy(gameObject, 0.1f); }
private void DropLoot() { for (int i = 0; i < DropTable.Length; i++) { if (UnityEngine.Random.value < DropTable[i].DropChancePercent / 100.0f) { var drop = Instantiate(DropTable[i].DropPrefab, transform.position, Quaternion.identity); drop.GetComponent <Rigidbody>().velocity = UnityEngine.Random.insideUnitSphere * 5.0f; DropChance.ResetMultiplier(); } } }