void OnPlayerDied(PlayerRespawnEvent evt) { var playerState = evt.PlayerState; var state = evt.MatchState; foreach (var respawnPosition in RespawnPositions) { if (respawnPosition == null) { continue; } var bounds = new Bounds(respawnPosition.position, RespawnBounds); bool occupied = false; for (var i = 0; i < state.PlayerCount; i++) { occupied |= bounds.Contains(state.GetPlayerState(i).Position); } if (occupied) { continue; } var resetEvent = new PlayerResetEvent(evt); Mediator.Global.Publish(resetEvent); playerState = resetEvent.PlayerState; playerState.Position = respawnPosition.position; break; } playerState.RespawnTimeRemaining = (uint)Mathf.FloorToInt(RespawnTime / Time.fixedDeltaTime); evt.PlayerState = playerState; }
[HookMethod("OnPlayerRespawn")] // Not being called every time? private void OnPlayerRespawn(PlayerRespawnEvent evt) { if (evt.Player != null) { // Call universal hook Interface.Call("OnPlayerRespawn", evt.Player.IPlayer, evt.Position); } }
// Use this for initialization void Start() { GameStartEvent.Register(onGameStart); PickUpEvent.Register(onCollectableGathered); PlayerRespawnEvent.Register(onPlayerRespawn); statistics = GameObject.FindGameObjectWithTag("Statistics").GetComponent <Statistics>(); slider = GetComponentInChildren <CircleSlider>(); text = GetComponentInChildren <Text>(); }
private void OnPlayerRespawn(PlayerRespawnEvent respawnEvent) { Player player = respawnEvent.Player; Log("Respawn from: " + player); if (player == null) { return; } updatePlayerName(player); }
// Use this for initialization void Start() { StartingImage = HealthIcons.Length - 1; lives = GameObject.FindGameObjectWithTag("Statistics").GetComponent <StatisticsTracker>().Lives; image = GetComponent <Image>(); image.sprite = HealthIcons[StartingImage]; livesText = GetComponentInChildren <Text>(); livesText.text = setLivesText(lives); PlayerDamagedEvent.Register(onDamageTaken); PlayerDeathEvent.Register(onPlayerDeath); PlayerRespawnEvent.Register(onPlayerRespawn); }
private void OnPlayerRespawn(PlayerRespawnEvent e) { if (LogEvents == false) { return; } string entityPosition = e.Player.Entity.Position.x + "," + e.Player.Entity.Position.y + "," + e.Player.Entity.Position.x; string str = ""; str += e.Player.DisplayName + " has respawned at [" + entityPosition + "]."; Log("Events", str); }
void OnEvent(PlayerRespawnEvent eventArgs) { if (Occupied || eventArgs.Consumed) { return; } eventArgs.Consumed = true; //TODO(james7132): Fix this _character = eventArgs.Player.PlayerObject.GetComponentInChildren <Character>(); _character.Movement.RpcMove(transform.position); _character.ResetCharacter(); _invincibility = Status.Apply <Invincibility>(_character, _invicibilityTimer + _platformTimer); _timer = 0f; eventArgs.Player.PlayerObject.SetActive(true); Occupied = true; _isOccupied = true; }
[HookMethod("OnPlayerRespawn")] // Not being called every time? private void OnPlayerRespawn(PlayerRespawnEvent evt) { // Call universal hook Interface.Call("OnUserRespawn", evt.Player.IPlayer); }
private void OnPlayerRespawn(PlayerRespawnEvent evt) { // Call covalence hook Interface.Call("OnUserRespawn", Covalence.PlayerManager.FindPlayer(evt.Player.Id.ToString())); }
[HookMethod("OnPlayerRespawn")] // Not being called every time? private void OnPlayerRespawn(PlayerRespawnEvent evt) { // Call hooks for plugins Interface.Call("OnUserRespawn", evt.Player.IPlayer); }
private void OnPlayerRespawn(PlayerRespawnEvent respawnEvent) { CheckPlayerExcists(respawnEvent.Player); ResetRaceChange(respawnEvent.Player); }
void onPlayerRespawn(PlayerRespawnEvent playerRespawnEvent) { image.sprite = HealthIcons[HealthIcons.Length - 1]; }
private void OnPlayerRespawn(PlayerRespawnEvent evt) { // Call covalence hook Interface.Call("OnUserRespawn", covalence.PlayerManager.GetPlayer(evt.Player.Id.ToString())); }
private void OnPlayerRespawn(PlayerRespawnEvent evt) { // Call covalence hook Interface.Call("OnUserRespawn", evt.Player.IPlayer); }
internal void TriggerSend(SteamPlayer player, string method, ESteamCall steamCall, ESteamPacket steamPacket, params object[] data) { try { if (player == null || player.player == null || player.playerID.steamID == CSteamID.Nil || player.player.transform == null || data == null) { return; } UnturnedPlayer unturnedPlayer = (UnturnedPlayer)playerManager.GetPlayer(player.playerID.steamID.ToString()); if (method.StartsWith("tellWear")) { //PlayerWearEvent method.Replace("tellWear", ""), (ushort)data[0], data.Count() > 1 ? (byte?)data[1] : null) return; } IEvent @event = null; switch (method) { case "tellBleeding": @event = new UnturnedPlayerUpdateBleedingEvent(unturnedPlayer, (bool)data[0]); break; case "tellBroken": @event = new UnturnedPlayerUpdateBrokenEvent(unturnedPlayer, (bool)data[0]); break; case "tellLife": @event = new UnturnedPlayerUpdateLifeEvent(unturnedPlayer, (byte)data[0]); break; case "tellFood": @event = new UnturnedPlayerUpdateFoodEvent(unturnedPlayer, (byte)data[0]); break; case "tellHealth": @event = new UnturnedPlayerUpdateHealthEvent(unturnedPlayer, (byte)data[0]); break; case "tellVirus": @event = new UnturnedPlayerUpdateVirusEvent(unturnedPlayer, (byte)data[0]); break; case "tellWater": @event = new UnturnedPlayerUpdateWaterEvent(unturnedPlayer, (byte)data[0]); break; case "tellStance": @event = new UnturnedPlayerUpdateStanceEvent(unturnedPlayer, (EPlayerStance)(byte)data[0]); break; case "tellGesture": @event = new UnturnedPlayerUpdateGestureEvent(unturnedPlayer, (EPlayerGesture)(byte)data[0]); break; case "tellStat": @event = new UnturnedPlayerUpdateStatEvent(unturnedPlayer, (EPlayerStat)(byte)data[0]); break; case "tellExperience": @event = new UnturnedPlayerUpdateExperienceEvent(unturnedPlayer, (uint)data[0]); break; case "tellRevive": @event = new PlayerRespawnEvent(unturnedPlayer); break; case "tellDead": @event = new UnturnedPlayerDeadEvent(unturnedPlayer, ((global::UnityEngine.Vector3)data[0]).ToSystemVector()); break; case "tellDeath": { var deathCause = (EDeathCause)(byte)data[0]; var limb = (ELimb)(byte)data[1]; var killerId = data[2].ToString(); playerManager.TryGetOnlinePlayerById(killerId, out var killer); @event = new UnturnedPlayerDeathEvent(unturnedPlayer, limb, deathCause, (killer as UnturnedPlayer)?.Entity); break; } } if (@event != null) { eventManager.Emit(this, @event); } } catch (Exception ex) { logger.LogError("Failed to receive packet \"" + method + "\"", ex); } }
void onPlayerRespawn(PlayerRespawnEvent playerRespawnEvent) { collectablesGathered = statistics.GetCollectablesGathered(); }