Пример #1
0
 public void RemoveSceneObject(GameObject2D sceneobject)
 {
     if (SceneObjects2D.Remove(sceneobject))
     {
         sceneobject.Scene = null;
     }
 }
Пример #2
0
 public void RemoveHUDObjectFront(GameObject2D hudObject)
 {
     if (HUDObjects2DFront.Remove(hudObject))
     {
         hudObject.Scene = null;
     }
 }
Пример #3
0
 public void RemoveHUDObjectBack(GameObject2D hudObject)
 {
     if (HUDObjects2DBack.Remove(hudObject))
     {
         hudObject.Scene = null;
     }
 }
Пример #4
0
 public void AddHUDObjectFront(GameObject2D hudObject)
 {
     if (!HUDObjects2DFront.Contains(hudObject))
     {
         hudObject.Scene = this;
         HUDObjects2DFront.Add(hudObject);
     }
 }
Пример #5
0
 public void AddHUDObjectBack(GameObject2D hudObject)
 {
     if (!HUDObjects2DBack.Contains(hudObject))
     {
         hudObject.Scene = this;
         HUDObjects2DBack.Add(hudObject);
     }
 }
Пример #6
0
 public void AddSceneObject(GameObject2D sceneobject)
 {
     if (!SceneObjects2D.Contains(sceneobject))
     {
         sceneobject.Scene = this;
         SceneObjects2D.Add(sceneobject);
     }
 }
Пример #7
0
 public void RemoveChild(GameObject2D child)
 {
     if (Children.Remove(child))
     {
         child.Scene  = null;
         child.Parent = null;
     }
 }
Пример #8
0
 public void AddChild(GameObject2D child)
 {
     if (!Children.Contains(child))
     {
         child.Scene  = Scene;
         child.Parent = this;
         Children.Add(child);
     }
 }
Пример #9
0
        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);
        }