private void Reloj_Elapsed(object sender, ElapsedEventArgs e) { TaskDispatcher.QueueOnMainThread(() => { Provider.clients.ForEach(delegate(SteamPlayer client) { UnturnedPlayer playeR; playeR = UnturnedPlayer.FromSteamPlayer(client); bool flag = Nadadores.Contains(playeR.CSteamID); if (!flag) { Savedata valor = playeR.GetComponent <Savedata>(); if (valor.tiempo <= 3) { playeR.Damage(100, playeR.Position, EDeathCause.BREATH, ELimb.SKULL, playeR.CSteamID); } else { valor.tiempo--; } } }); }); }
public void FixedUpdate() { Provider.clients.ForEach(delegate(SteamPlayer client) { UnturnedPlayer player; player = UnturnedPlayer.FromSteamPlayer(client); bool flag = Nadadores.Contains(player.CSteamID); Savedata valor = player.GetComponent <Savedata>(); if (!flag) { if (player.Player.stance.isBodyUnderwater) { if (valor.tiempo <= 16) { if (valor.sonido_activo) { return; } else { valor.sonido_activo = true; EffectManager.sendEffect(45001, 15, player.Position); } } else if (valor.tiempo <= 3) { player.Damage(100, player.Position, EDeathCause.BREATH, ELimb.SKULL, player.CSteamID); } } else { valor.tiempo = 30; valor.sonido_activo = false; EffectManager.askEffectClearByID(45001, player.CSteamID); } } }); }