public static void RemovePhyicsObject(PhysicsObject physicsObject) { if (sceneList.Contains(physicsObject)) { sceneList.Remove(physicsObject); } }
public GameObject(string spriteName, Vector2 initialPosition, Vector2 size) { graphicsChild = new GraphicsObject(this, spriteName); physicsChild = new PhysicsObject(this, initialPosition, size); worldPosition = initialPosition; worldScale = size; }
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)); } }
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; }
public void AddCollider(PhysicsObject collider) { parent.AddCollider(collider.parent); }