void Die()
 {
     bs.CeaseFirePrimary();
     if (Random.value <= dropRate)
     {
         int rand = Random.Range(0, bs.primaryWeaponSockets.Length + 1);
         if (rand == bs.primaryWeaponSockets.Length)
         {
             bs.DetachTransport(false);
         }
         else
         {
             bs.DetachPrimaryWeapon(rand, false);
         }
     }
 }
Esempio n. 2
0
 void OnTriggerStay(Collider other)
 {
     if (gameObject.layer == LayerMask.NameToLayer("Item"))
     {
         if (Input.GetButtonDown("EquipLeft"))
         {
             transform.localRotation = Quaternion.Euler(0, 0, 0);
             transform.localPosition = Vector3.zero;
             transform.localScale    = Vector3.one;
             BodySockets oBS = other.GetComponent <BodySockets> ();
             oBS.DetachPrimaryWeapon(0, false);
             oBS.AttachPrimaryWeapon(0, GetComponent <PrimaryWeaponNode>());
         }
         if (Input.GetButtonDown("EquipRight"))
         {
             transform.localRotation = Quaternion.Euler(0, 0, 0);
             transform.localPosition = Vector3.zero;
             transform.localScale    = Vector3.one;
             BodySockets oBS = other.GetComponent <BodySockets> ();
             oBS.DetachPrimaryWeapon(1, false);
             oBS.AttachPrimaryWeapon(1, GetComponent <PrimaryWeaponNode>());
         }
     }
 }