public void OnPlayerHurt(object sender, object e) { if (!_parser.MatchStarted) { return; } var eventArgs = (PlayerHurtEventArgs)e; var parser = (DemoParser)sender; var playerHurt = new PlayerHurt() { Victim = new PartialPlayer(eventArgs.Player), Weapon = new PartialWeapon(eventArgs.Weapon), HitGroup = eventArgs.Hitgroup }; if (eventArgs.Attacker != null) { playerHurt.Attacker = new PartialPlayer(eventArgs.Attacker); } else { playerHurt.IsFallDamage = true; } PlayerHurtFrame frame = null; if (PlaybackManager.Instance.PlayerHurtFrames.Any()) { frame = PlaybackManager.Instance.PlayerHurtFrames.Last(); } if (frame == null || frame.Tick != parser.CurrentTick) { frame = new PlayerHurtFrame() { Tick = parser.CurrentTick, PlayerHurts = new List <PlayerHurt>() { playerHurt } }; PlaybackManager.Instance.PlayerHurtFrames.Add(frame); } else { frame.PlayerHurts.Add(playerHurt); } }
public void UpdatePlayerHurtFrame(PlayerHurtFrame frame, int playbackScale, Vector3 mapOffset) { for (int i = 0; i < frame.PlayerHurts.Count; i++) { var playerHurt = frame.PlayerHurts[i]; if (!playerHurt.IsFallDamage) { CreateWeaponFireGraphics(playerHurt, playbackScale, mapOffset); } //damage victim } }
public void DisplayPlayerHurtFrame(PlayerHurtFrame frame) { PlayerHurtGraphicsManager.Instance.UpdatePlayerHurtFrame(frame, PlaybackScale, Map.Offset); }