예제 #1
0
 public static void RemovePhyicsObject(PhysicsObject physicsObject)
 {
     if (sceneList.Contains(physicsObject))
     {
         sceneList.Remove(physicsObject);
     }
 }
예제 #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;
        }
예제 #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));
     }
 }
예제 #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;
 }
예제 #5
0
 public void AddCollider(PhysicsObject collider)
 {
     parent.AddCollider(collider.parent);
 }