fix(TopDownShooter): simplify Flashlight code

This commit is contained in:
MrGadget 2024-07-30 11:31:14 -04:00
parent 87ca42eda9
commit 7ada79e6a1

View File

@ -183,15 +183,7 @@ IEnumerator GunShotEffect()
[Command]
public void CmdFlashLight()
{
if (flashLightStatus == true)
{
flashLightStatus = false;
}
else
{
flashLightStatus = true;
}
RpcFlashLight();
flashLightStatus = !flashLightStatus;
}
// our sync var hook, which sets flashlight status to the same on all clients for this player
@ -199,13 +191,6 @@ void OnFlashLightChanged(bool _Old, bool _New)
{
#if !UNITY_SERVER
flashLight.enabled = _New;
#endif
}
[ClientRpc]
void RpcFlashLight()
{
#if !UNITY_SERVER
soundFlashLight.Play();
#endif
}