private bool IsItemOutdated(GobTrackerItem item) { if (item.Gob.Dead || item.Gob.IsDisposed) return true; if (item.TrackerGob != null) { if (item.TrackerGob.Dead || item.TrackerGob.IsDisposed) return true; } return false; }
private void CreateGobTrackers() { if (_targetTracker != null) throw new ApplicationException("Rocket is creating a gob tracker although it has one already"); if (Target == null) return; _targetTracker = new GobTrackerItem(Target, this, "gui_tracker_rockettarget") { StickToBorders = false, ShowWhileTargetOnScreen = true, }; if (PlayerOwner != null) PlayerOwner.GobTrackerItems.Add(_targetTracker); var targetPlayerOwner = Target.Owner as Player; if (targetPlayerOwner != null) targetPlayerOwner.GobTrackerItems.Add(_targetTracker); }
private void RemoveGobTrackers() { if (_targetTracker == null) return; if (PlayerOwner != null) PlayerOwner.GobTrackerItems.Remove(_targetTracker); if (_targetTracker.Gob != null) { var targetPlayerOwner = _targetTracker.Gob.Owner as Player; if (targetPlayerOwner != null) targetPlayerOwner.GobTrackerItems.Remove(_targetTracker); } _targetTracker = null; }
private void AddGobTrackerToViewports(Gob gob, string textureName) { var trackerItem = new GobTrackerItem(gob, null, textureName); foreach (var plr in Game.DataEngine.Players) if (plr.IsLocal) plr.GobTrackerItems.Add(trackerItem); }