public void PutWeaponInHand(WeaponConfig weaponToUse) { if (GetComponent <PlayerStats>()) { playerStats.WeaponUpdate(weaponToUse);//let playerStats.WeaponUpdate know about new weapon } else { UpdateCurrentWeapon = weaponToUse; } var weaponPrefab = weaponToUse.GetWeaponPrefab(); GameObject dominantHand = RequestDominantHand(); if (weaponObject) { Destroy(weaponObject); } weaponObject = Instantiate(weaponPrefab, dominantHand.transform); weaponObject.transform.localPosition = UpdateCurrentWeapon.gripTransform.localPosition; weaponObject.transform.localRotation = UpdateCurrentWeapon.gripTransform.localRotation; }
//set newweapon in armourEquippedConfig and updateCurrentWeapon public void WeaponUpdate(WeaponConfig newWeaponEquipped) { weaponSystem.UpdateCurrentWeapon = newWeaponEquipped; armourEquippedConfig.WeaponSlotEquipped = newWeaponEquipped; }