public void UpdateNadeProjectileFrame(NadeProjectileFrame frame, Map map) { _debugText.text = $"There should be {frame.NadeProjectiles.Count} nades"; var leftOverGuids = _nadeProjectiles.Keys.ToList(); for (int i = 0; i < frame.NadeProjectiles.Count; i++) { var nade = frame.NadeProjectiles[i]; if (leftOverGuids.Contains(nade.Guid)) { leftOverGuids.Remove(nade.Guid); } else { AddNadeProjectile(nade, map); } _nadeProjectiles[nade.Guid].UpdatePosition((DemoInfoHelper.SourceToUnityVector(nade.GetPos()) / PlaybackScale) - map.Offset); EnsureNadeHasTrail(nade.Guid); } foreach (Guid guid in leftOverGuids) { RemoveNadeProjectile(guid); } }
public void OnTickDone(object sender, object ea) { var parser = (DemoParser)sender; _parser.Progress = parser.ParsingProgess; if (UIManager.Instance.ParsingProgressLoaderUI != null) { if (parser.CurrentTick % 100 == 0) { _parser.Enqueue((s, e) => UIManager.Instance.ParsingProgressLoaderUI.UpdateProgress(parser.ParsingProgess), "UI update progress"); } } var players = parser.PlayingParticipants .Select(p => new PartialPlayer(p)) .ToArray(); var frame = new Frame() { Tick = parser.CurrentTick, Players = players }; PlaybackManager.Instance.Frames.Add(frame); if (parser.Nades.Count != 0) { var nades = parser.Nades.Select(n => n.Value.Copy()) .Where(n => n.IsReady) .ToList(); var nadeProjectileFrame = new NadeProjectileFrame() { Tick = parser.CurrentTick, NadeProjectiles = nades }; NadePlaybackManager.Instance.AddNadeProjectileFrame(nadeProjectileFrame); } }
public void OnTickDone(object sender, object e) { var parser = (DemoParser)sender; if (!_parser.MatchStarted) { return; } var players = parser.PlayingParticipants .Select(p => new PartialPlayer(p)) .ToArray(); var frame = new Frame() { Tick = parser.CurrentTick, Players = players }; PlaybackManager.Instance.Frames.Add(frame); if (parser.Nades.Count != 0) { var nades = parser.Nades.Select(n => n.Value.Copy()) .Where(n => n.IsReady) .ToList(); var nadeProjectileFrame = new NadeProjectileFrame() { Tick = parser.CurrentTick, NadeProjectiles = nades }; NadePlaybackManager.Instance.AddNadeProjectileFrame(nadeProjectileFrame); } }
public void AddNadeProjectileFrame(NadeProjectileFrame frame) { NadeProjectileFrames.Add(frame); }
public void UpdateNadeProjectileFrame(NadeProjectileFrame frame) { NadeGraphicsManager.Instance.UpdateNadeProjectileFrame(frame, Map); }