public static bool IntersectBoundingBoxes(AbstractEntity entity1, AbstractEntity entity2, int alphaThreshold1, int alphaThreshold2) { // Get the bounding rectangle of the person Rectangle entity1Rectangle = new Rectangle((int)entity1.Position.X, (int)entity1.Position.Y, entity1.Texture.Width, entity1.Texture.Height); // Get the bounding rectangle of this block Rectangle entity2Rectangle = new Rectangle((int)entity2.Position.X, (int)entity2.Position.Y, entity2.Texture.Width, entity2.Texture.Height); // The color data for the images; used for per pixel collision Color[] entity1TextureData = new Color[entity1.Texture.Width * entity1.Texture.Height]; Color[] entity2TextureData = new Color[entity2.Texture.Width * entity2.Texture.Height]; entity1.Texture.GetData(entity1TextureData); entity2.Texture.GetData(entity2TextureData); return IsIntersectingPixels(entity1Rectangle, entity2Rectangle, entity1TextureData, entity2TextureData, 0, 0); }
public void AddPlayer(AbstractEntity entity) { _player = entity; _entities.Add(_player); }
public void AddEntity(AbstractEntity entity) { _entities.Add(entity); }