/// <summary> /// Die method. /// </summary> public virtual IEnumerator Die() { isAlive = false; canBeStunned = false; currentHp = 0f; if (isMoving) { StopMoving(); } if (inBattle) { StopBattle(); } // disable physics for this enemy - they are not longer neecesary. if (_rigi != null) { _rigi.isKinematic = true; _rigi.useGravity = false; } // remove colliders UpdateColliderStatus(false); // disable enemy in the enemy group. if (enemyGroup != null) { enemyGroup.DisableEnemy(publicID); } // display death particles if required. if (deathParticles) { StartCoroutine(deathParticles.DisplayDeathParticles()); } // update data defeated value. data.defeated++; // grant player experience. Player.instance.weapon.GetExp(data.expGiven); // update UI with exp given. GamePlayUI.instance.weaponSectionUI.UpdateExpUI(data.expGiven); // let animation happen before the loot drops. yield return(new WaitForSeconds(.5f)); loot.DropLoot(); yield return(null); }