Exemple #1
0
 /* Enter dead state, warding experience to the killder. */
 public void Die(GameObject weapon = null)
 {
     Item item = weapon != null ? weapon.GetComponent<Item>() : null;
     CreateDeathEvent(item);
     stats.dead = true;
     Ragdoll(true);
     droppedLoot = arms.AllItems();
     arms.Drop();
     arms.Drop();
     if(ai != null){ ai.Pause(); }
     if(item && item.holder){
       item.holder.ReceiveXp(stats.NextLevel(stats.level -1));
     }
     GetComponent<BoxCollider>().isTrigger = false;
     BoxCollider[] colliders = GetComponentsInChildren<BoxCollider>();
     foreach(BoxCollider bc in colliders){ bc.isTrigger = false; }
     if(anim){ anim.enabled = false; }
     Rigidbody[] rbs = GetComponentsInChildren<Rigidbody>();
     foreach(Rigidbody rb in rbs){ rb.isKinematic = false; }
 }