Пример #1
0
    public override void OnAction()
    {
        if (Item)
        {
            if (throwType == 0)
            {
                character.CmdRequestThrowObject(fpsController.PlayerView.FPSCamera.RayPointer.position + fpsController.PlayerView.FPSCamera.RayPointer.forward, fpsController.PlayerView.FPSCamera.RayPointer.rotation, ItemID, fpsController.PlayerView.FPSCamera.RayPointer.forward * Force1);
            }
            else
            {
                character.CmdRequestThrowObject(fpsController.PlayerView.FPSCamera.RayPointer.position + fpsController.PlayerView.FPSCamera.RayPointer.forward, fpsController.PlayerView.FPSCamera.RayPointer.rotation, ItemID, fpsController.PlayerView.FPSCamera.RayPointer.forward * Force2);
            }

            if (SoundThrow && audioSource)
            {
                if (audioSource.enabled)
                {
                    audioSource.PlayOneShot(SoundThrow);
                }
            }
        }
        if (ItemUsed != null)
        {
            if (!InfinityAmmo)
            {
                if (character != null && character.inventory != null && !character.inventory.RemoveItem(ItemUsed, 1))
                {
                    return;
                }
            }
        }
        base.OnAction();
    }