public void OnNextWeapon(InputAction.CallbackContext context) { if (context.phase == InputActionPhase.Started) { SwitchWeapon.Invoke(true); } }
public void OnPreviousWeapon(InputAction.CallbackContext context) { if (context.phase == InputActionPhase.Started) { SwitchWeapon.Invoke(false); } }
protected override void ExecuteCombo(int id) { switch (id) { case 40: SwitchWeapon?.Invoke(); break; case 50: FireOn?.Invoke(); break; case 51: FireOff?.Invoke(); break; } }
void EquipWeapon(PlayerWeapon _weapon) { currentWeapon = _weapon; weaponInst = Instantiate(_weapon.WeaponGraphics, weaponHolder.position, weaponHolder.rotation); weaponInst.transform.SetParent(weaponHolder); //to set weapon holder its parent switchWeapon?.Invoke(currentWeapon.Name); //launching a event which sends weapon name currentWeaponGraphics = weaponInst.GetComponent <WeaponGraphics>(); //we check for the component graphics on the weapon Instance if (currentWeaponGraphics == null) { Debug.LogError("no graphics on weapon" + weaponInst.name); } if (isLocalPlayer) { Util.SetLayerRecursively(weaponInst, LayerMask.NameToLayer(weaponLayerName)); } if (!isLocalPlayer) { //SetLayerRecursively(_weapon.WeaponGraphics, LayerMask.NameToLayer("RemoteplayerLayer")); } // _weapon.handLeft.transform.Translate(currentWeaponGraphics.leftGunGrip.transform.position); }