fix(TopDownShooter): simplify Flashlight code

This commit is contained in:
MrGadget 2024-07-30 11:31:14 -04:00
parent 38a05a0925
commit 136bf579e2

View File

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