public void Perform(Marian marian, Item item) { var aabb = marian.BoundingBox.Bounds; var aabbItem = item.BoundingBox.Bounds; if (aabbItem.Intersects(aabb)) { item.PickUp(marian); } }
public DynamicCollisionDetectionEngine(Marian marian) { this.marian = marian; npcs = new List<Npc>(); items = new List<Item>(); collisionDetection = new DynamicCollisionDetection(); marian.Move += marian_Move; }
public void Perform(Marian marian, Npc npc) { var aabb = marian.BoundingBox.Bounds; var aabbNpc = npc.BoundingBox.Bounds; if (aabbNpc.Intersects(aabb)) { if (!marian.Invulnerable) { marian.Die(); } } }
private void InitializeMarian() { if (marian == null) { marian = new Marian(); marian.Move += game.ViewportManager.CharacterMove; } var collisionDetection = marian.Movement.CollisionDetection as IGameContent; if (collisionDetection != null) { game.AddContent(collisionDetection); } game.DynamicCollisionDetection = new DynamicCollisionDetectionEngine(marian); }
public abstract void PickUp(Marian marian);
public override void PickUp(Marian marian) { marian.BreakOut(); }