public void SetRightWeapon(GameObject weapon) { if (weapon != null) { var w = weapon.GetComponent <vShooterWeapon>(); rWeapon = w; if (rWeapon) { rWeapon.ignoreTags = ignoreTags; rWeapon.hitLayer = aimTargetLayer; rWeapon.root = transform; rWeapon.onDestroy.AddListener(OnDestroyWeapon); if (usingThirdPersonController) { if (useAmmoDisplay && !ammoDisplay) { ammoDisplay = FindObjectOfType <vAmmoDisplay>(); } if (useAmmoDisplay && ammoDisplay) { ammoDisplay.Show(); } UpdateTotalAmmo(); } currentShotTime = 0; } } }
private void SetRightWeapon(vShooterWeapon weapon) { rWeapon = weapon; if (rWeapon) { rWeapon.inHolder = false; rWeapon.ignoreTags = ignoreTags; rWeapon.hitLayer = damageLayer; rWeapon.root = transform; rWeapon.onDisable.RemoveListener(HideRightAmmoDisplay); rWeapon.onDisable.AddListener(HideRightAmmoDisplay); rWeapon.onDestroy.RemoveListener(OnDestroyWeapon); rWeapon.onDestroy.AddListener(OnDestroyWeapon); if (rWeapon.dontUseReload) { LoadAllAmmo(rWeapon, false); } if (rWeapon.secundaryWeapon) { rWeapon.secundaryWeapon.ignoreTags = ignoreTags; rWeapon.secundaryWeapon.hitLayer = damageLayer; rWeapon.secundaryWeapon.root = transform; rWeapon.secundaryWeapon.isSecundaryWeapon = true; if (rWeapon.secundaryWeapon.dontUseReload) { LoadAllAmmo(rWeapon.secundaryWeapon, true); } } if (usingThirdPersonController) { if (useAmmoDisplay && !ammoDisplayR) { GetAmmoDisplays(); } if (useAmmoDisplay && ammoDisplayR) { ammoDisplayR.Show(); } UpdateRightAmmo(); } LoadIKAdjust(rWeapon.weaponCategory); onEquipWeapon.Invoke(weapon.gameObject, false); } }
public virtual void SetRightWeapon(GameObject weapon) { if (weapon != null) { var w = weapon.GetComponent <vShooterWeapon>(); rWeapon = w; if (rWeapon) { rWeapon.ignoreTags = ignoreTags; rWeapon.hitLayer = damageLayer; rWeapon.root = transform; rWeapon.onDestroy.AddListener(OnDestroyWeapon); if (rWeapon.dontUseReload) { LoadAllAmmo(rWeapon, false); } if (rWeapon.secundaryWeapon) { rWeapon.secundaryWeapon.ignoreTags = ignoreTags; rWeapon.secundaryWeapon.hitLayer = damageLayer; rWeapon.secundaryWeapon.root = transform; rWeapon.secundaryWeapon.isSecundaryWeapon = true; if (rWeapon.secundaryWeapon.dontUseReload) { LoadAllAmmo(rWeapon.secundaryWeapon, true); } } if (usingThirdPersonController) { if (useAmmoDisplay && !ammoDisplayR) { GetAmmoDisplays(); } if (useAmmoDisplay && ammoDisplayR) { ammoDisplayR.Show(); } UpdateRightAmmo(); } currentShotTime = 0; LoadIKAdjust(rWeapon.weaponCategory); } } }
public void SetRightWeapon(GameObject weapon) { if (weapon != null) { var w = weapon.GetComponent <vShooterWeapon>(); rWeapon = w; if (rWeapon) { rWeapon.ignoreTags = ignoreTags; rWeapon.hitLayer = aimTargetLayer; rWeapon.root = transform; rWeapon.onDestroy.AddListener(OnDestroyWeapon); if (rWeapon.autoReload) { ReloadWeaponAuto(rWeapon, false, false); } if (rWeapon.secundaryWeapon) { rWeapon.secundaryWeapon.ignoreTags = ignoreTags; rWeapon.secundaryWeapon.hitLayer = aimTargetLayer; rWeapon.secundaryWeapon.root = transform; rWeapon.secundaryWeapon.isSecundaryWeapon = true; if (rWeapon.secundaryWeapon.autoReload) { ReloadWeaponAuto(rWeapon.secundaryWeapon, false, true); } } if (usingThirdPersonController) { if (useAmmoDisplay && !ammoDisplayR) { GetAmmoDisplays(); } if (useAmmoDisplay && ammoDisplayR) { ammoDisplayR.Show(); } UpdateRightAmmo(); } currentShotTime = 0; } } }