Ejemplo n.º 1
0
 public void OnNextWeapon(InputAction.CallbackContext context)
 {
     if (context.phase == InputActionPhase.Started)
     {
         SwitchWeapon.Invoke(true);
     }
 }
Ejemplo n.º 2
0
 public void OnPreviousWeapon(InputAction.CallbackContext context)
 {
     if (context.phase == InputActionPhase.Started)
     {
         SwitchWeapon.Invoke(false);
     }
 }
Ejemplo n.º 3
0
        protected override void ExecuteCombo(int id)
        {
            switch (id)
            {
            case 40:
                SwitchWeapon?.Invoke();
                break;

            case 50:
                FireOn?.Invoke();
                break;

            case 51:
                FireOff?.Invoke();
                break;
            }
        }
Ejemplo n.º 4
0
 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);
 }