public void SpawnEquip(GameObject weaponPrefab) { // Create weapon GameObject newWeapon = Instantiate(weaponPrefab); weapon = newWeapon.GetComponent <Weapon>(); // Attach to parent bone Attachment_Helper attachmentHelper = newWeapon.GetComponent <Attachment_Helper>(); attachmentHelper.SetAttachment(WeaponBoneR); }
public void Dequip() { if (weapon != null) { // Attach to parent bone Attachment_Helper attachmentHelper = weapon.GetComponent <Attachment_Helper>(); attachmentHelper.SetAttachment(null); // Call weapon equip Weapon_Equip_Helper equipHelper = weapon.GetComponent <Weapon_Equip_Helper>(); equipHelper.setUser(null); // Nullify link weapon = null; } }
public void Equip(Weapon newWeapon) { OnEquip.Invoke(newWeapon); // Call weapon equip Weapon_Equip_Helper equipHelper = newWeapon.GetComponent <Weapon_Equip_Helper>(); if (equipHelper.getUser() == null) { equipHelper.setUser(identity); // Assign weapon = newWeapon; // Attach to parent bone Attachment_Helper attachmentHelper = newWeapon.GetComponent <Attachment_Helper>(); attachmentHelper.SetAttachment(WeaponBoneR); } }