protected virtual void OnEntityAdded(Entity obj) { if (IsClickable(obj)) { Clickables.Insert(obj, obj.PickingWorldBounding); } obj.ClickableChanged += new EventHandler(UpdateEntityBounding); obj.IsVisibleChanged += new EventHandler(UpdateEntityBounding); obj.PickingLocalBoundingChanged += new EventHandler(UpdateEntityBounding); obj.Transformed += new EventHandler(UpdateEntityBounding); if (obj.Updateable) { updateables.Add(obj); } obj.UpdateableChanged += new EventHandler(obj_UpdateableChanged); }
void UpdateEntityBounding(object sender, EventArgs e) { var ent = (Entity)sender; if (IsClickable(ent)) { if (!Clickables.Contains(ent)) { Clickables.Insert(ent, ent.PickingWorldBounding); } else { Clickables.Move(((Entity)sender), ((Entity)sender).PickingWorldBounding); } } else { Clickables.Remove(ent); } }