Exemple #1
0
    public void Pickup()
    {
        var objects = inside.GetObjectsInside();

        foreach (var thing in objects)
        {
            if (thing != null)
            {
                var foodRef = thing.GetComponent <FoodReference>();
                if (foodRef != null)
                {
                    var food    = foodRef.food;
                    var destroy = foodRef.destroy;
                    storage.AddFood(food);
                    inside.Remove(thing);
                    Destroy(destroy);
                    break;
                }
            }
        }
    }
 private void OnAddFood(object sender, RoutedEventArgs e)
 {
     foodStorage.AddFood(mainViewModel.Food);
     mainViewModel.Food = new Food();
 }