Beispiel #1
0
 public static void RemovePhyicsObject(PhysicsObject physicsObject)
 {
     if (sceneList.Contains(physicsObject))
     {
         sceneList.Remove(physicsObject);
     }
 }
Beispiel #2
0
        public GameObject(string spriteName, Vector2 initialPosition, Vector2 size)
        {
            graphicsChild = new GraphicsObject(this, spriteName);
            physicsChild = new PhysicsObject(this, initialPosition, size);

            worldPosition = initialPosition;
            worldScale = size;
        }
Beispiel #3
0
 public static void RegisterPhysicsObject(PhysicsObject physicsObject)
 {
     if (!sceneList.Contains(physicsObject))
     {
         sceneList.Add(physicsObject);
         SceneMinCorner = new Vector2(Math.Min(physicsObject.MinCorner.X, SceneMinCorner.X), Math.Min(physicsObject.MinCorner.Y, SceneMinCorner.Y));
         SceneMaxCorner = new Vector2(Math.Max(physicsObject.MaxCorner.X, SceneMaxCorner.X), Math.Max(physicsObject.MaxCorner.Y, SceneMaxCorner.Y));
     }
 }
Beispiel #4
0
 public bool Intersects(PhysicsObject collider)
 {
     return this.minCorner.X < collider.maxCorner.X && this.maxCorner.X > collider.minCorner.X &&
            this.minCorner.Y < collider.maxCorner.Y && this.maxCorner.Y > collider.minCorner.Y;
 }
Beispiel #5
0
 public void AddCollider(PhysicsObject collider)
 {
     parent.AddCollider(collider.parent);
 }