Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    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;
        }
    }
Esempio n. 3
0
    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);
        }
    }