mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
fix(TopDownShooter): simplify Flashlight code
This commit is contained in:
parent
38a05a0925
commit
136bf579e2
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user