public void Collide(IEnumerable <Animal> colliders, IEnumerable <GameObject> destroyables) { foreach (var destroyable in destroyables) { foreach (var collider in colliders) { if (destroyable.TopLeft == collider.TopLeft) { destroyable.IsDestroyed = true; Byproduct byproduct = collider.Produce(this.GetByproductColor(destroyable)); if (byproduct != null) { this.AddGameObject(byproduct, this.farm, this.gameObjects); } } } } }
public void GatherProduct(Byproduct product) { this.AddToInventory(product); product.IsDestroyed = true; }