add flashlight sounds

This commit is contained in:
Mister_Nebula 2021-12-14 22:56:54 +00:00
parent fdf88e0cb3
commit 6ee84bce7a
3 changed files with 13 additions and 1 deletions

View File

@ -37,6 +37,12 @@ namespace QSB.Audio
public void PlayUnequipTool()
=> _oneShotExternalSource.PlayOneShot(AudioType.ToolTranslatorUnequip, 1f);
public void PlayTurnOnFlashlight()
=> _oneShotExternalSource.PlayOneShot(AudioType.ToolFlashlightOn, 1f);
public void PlayTurnOffFlashlight()
=> _oneShotExternalSource.PlayOneShot(AudioType.ToolFlashlightOff, 1f);
private OWAudioSource CreateBaseAudio(
string name,
bool loop,

View File

@ -15,7 +15,9 @@ namespace QSB.Tools.FlashlightTool
var oldComponent = flashlightRoot.GetComponent<Flashlight>();
var component = flashlightRoot.AddComponent<QSBFlashlight>();
component.Player = player;
component.Init(oldComponent);
oldComponent.enabled = false;
flashlightRoot.transform.parent = player.CameraBody.transform;

View File

@ -1,4 +1,5 @@
using UnityEngine;
using QSB.Player;
using UnityEngine;
namespace QSB.Tools.FlashlightTool
{
@ -14,6 +15,7 @@ namespace QSB.Tools.FlashlightTool
private LightSourceVolume _lightSourceVolume;
public bool FlashlightOn;
public PlayerInfo Player;
public void Start()
{
@ -73,6 +75,7 @@ namespace QSB.Tools.FlashlightTool
}
FlashlightOn = true;
Player.AudioController.PlayTurnOnFlashlight();
var rotation = _root.rotation;
_basePivot.rotation = rotation;
_baseRotation = rotation;
@ -93,6 +96,7 @@ namespace QSB.Tools.FlashlightTool
}
FlashlightOn = false;
Player.AudioController.PlayTurnOffFlashlight();
_lightSourceVolume.SetVolumeActivation(FlashlightOn);
}