void ManageDestruction(bool isPlayer = false) { if (deathOnPlayerCollide && isPlayer) { //Find and Disable the Drop Item Script. if (transform.root.GetComponent <NPC_DropItems> () != null) { transform.root.GetComponent <NPC_DropItems> ().enabled = false; } if (hitEffectsCustom != null) { Instantiate(hitEffectsCustom, gameObject.transform.position, gameObject.transform.rotation); } npcMaster.CallEventNpcDeath(); } else { //Just Spawn hitEffects and be done with it. if (hitEffectsCustom != null) { Instantiate(hitEffectsCustom, gameObject.transform.position, gameObject.transform.rotation); } } }
void DeductHealth(int healthChange) { npcHealth -= healthChange; if (npcHealth <= 0) { npcHealth = 0; npcMaster.CallEventNpcDeath(); Destroy(gameObject, destroyWaitTime); } CheckHealthFraction(); }