public void AddSceneObject(GameObject2D sceneObject) { if (!SceneObjects2D.Contains(sceneObject)) { sceneObject.Scene = this; SceneObjects2D.Add(sceneObject); } }
public void RemoveSceneObject(GameObject2D sceneObject) { if (SceneObjects2D.Remove(sceneObject)) { sceneObject.Scene = null; } }
public bool HitTest(GameObject2D gameObj) { if (!gameObj.BoundingRect.HasValue) return false; if (BoundingRect.HasValue && BoundingRect.Value.Intersects(gameObj.BoundingRect.Value)) return true; return Children.FirstOrDefault(child => child.HitTest(gameObj)) != null; }
public void RemoveChild(GameObject2D child) { if (Children.Remove(child)) { child.Scene = null; child.Parent = null; } }
public void AddChild(GameObject2D child) { if (!Children.Contains(child)) { child.Scene = Scene; child.Parent = this; Children.Add(child); } }