コード例 #1
0
 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);
                 }
             }
         }
     }
 }
コード例 #2
0
 public void GatherProduct(Byproduct product)
 {
     this.AddToInventory(product);
     product.IsDestroyed = true;
 }