Inheritance: MonoBehaviour
        public static void SerializeFood(Food value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Food");
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if( value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents) )
                writer.WriteRefIdContents(value.InternalId.Contents);

            // Serialize element extension
            if(value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach(var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if(value.Language != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.Language, writer);
                writer.WriteEndElement();
            }

            // Serialize element text
            if(value.Text != null)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if(value.Contained != null && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach(var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Example #2
5
        public async Task<IHttpActionResult> PutFood(Guid id, Food food)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != food.Id)
            {
                return BadRequest();
            }

            db.Entry(food).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FoodExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Example #3
3
 public bool addFood(Food f)
 {
     if(f.getWeight() + weight > weightLimit) {
         return false;
     } else {
         foods.Add(f);
         weight += f.getWeight();
         return true;
     }
 }
Example #4
0
 public Food(string Init_name, int p_price, int p_costs)
 {
     this.instance = this;
     this.instance.name = Init_name;
     this.instance.price = p_price;
     this.instance.costs = p_costs;
 }
Example #5
0
        public async Task<IHttpActionResult> PostFood(Food food)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.Foods.Add(food);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (FoodExists(food.Id))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return CreatedAtRoute("DefaultApi", new { id = food.Id }, food);
        }
        protected override void AddObjectToFarm(string[] inputCommands)
        {
            string type = inputCommands[1];
            string id = inputCommands[2];

            switch (type)
            {
                case "Grain":
                    var food = new Food(id, ProductType.Grain, FoodType.Organic, 10, 2);
                    this.farm.AddProduct(food);
                    break;
                case "CherryTree":
                    var cherryTree = new CherryTree(id);
                    this.farm.Plants.Add(cherryTree);
                    break;
                case "TobaccoPlant":
                    var tobaccoPlant = new TobaccoPlant(id);
                    this.farm.Plants.Add(tobaccoPlant);
                    break;
                case "Cow":
                    var cow = new Cow(id);
                    this.farm.Animals.Add(cow);
                    break;
                case "Swine":
                    var swine = new Swine(id);
                    this.farm.Animals.Add(swine);
                    break;
                default:
                    break;
            }
        }
 public World(ContentManager content, Rectangle Bounds)
 {
     this.Bounds = Bounds;
     this.TextureCreature = content.Load<Texture2D>("Bug");
     this.TexturePoint = content.Load<Texture2D>("Point");
     this.TextureFood = content.Load<Texture2D>("Circle");
     this.MyFont = content.Load<SpriteFont>("MyFont");
     this.camera = new Camera(new Viewport(this.Bounds));
     this.basicshapes = new BasicShapes();
     creature = new List<Creature>();
     for (int i = 0; i < NrOfCreatures; i++)
     {
         Creature c = new Creature(Bounds);
         creature.Add(c);
     }
     food = new List<Food>();
     for (int i = 0; i < NrOfFood; i++)
     {
         Food f = new Food(Bounds);
         food.Add(f);
     }
     obstacle = new List<Obstacle>();
     for (int i = 0; i < NrOfObstacles; i++)
     {
         Obstacle o = new Obstacle(Bounds);
         obstacle.Add(o);
     }
     camera = new Camera(new Viewport(0, 0, 1600, 900));
     GA = new GeneticAlgorithm(60, 1);
     NrOfDeaths = 0;
     GraphValue = new double[32000];
     DoDraw = true;
 }
 public Chronic(string name, Water water, Light light, Food food)
     : this(name)
 {
     Water = water;
     Light = light;
     Food = food;
 }
Example #9
0
 public Position calculateBeta(Krill krill, Food food, HerdParameters parameters)
 {
     Position betaFood = calculateBetaFood(food,krill);
     Position betaBest = calculateBetaBest(krill,parameters);
     //Debug.Log("Food " + betaFood + " best " + betaBest);
     return betaFood + betaBest;
 }
Example #10
0
 public FoodItemViewModel(Food food)
     : this()
 {
     Id = food.Id;
     Name = food.Name;
     Icon = food.Icon;
 }
Example #11
0
 public Herd(Transform carTransform,Transform[] krillViz,Transform visualFoodTransform)
 {
     this.carTransform = carTransform;
     this.krillViz = krillViz;
     krillSetter = new CircleKrillSetter(new HerdParameters());
     food = new Food(algorithmParameters,visualFoodTransform);
 }
Example #12
0
 public virtual void HandleFood(Food food)
 {
     // Якщо не в змозі подужати їжу, передаємо її ближчому другові
     if (CafeVisitor != null)
     {
       CafeVisitor.HandleFood(food);
     }
 }
Example #13
0
 public ActionResult GetFoodList()
 {
     Food food = new Food { Title = "Moe's", Description = "Mexican food" };
     List<Food> foodList = new List<Food>();
     foodList.Add(food);
     foodList.Add(new Food { Title = "5 guys", Description = "Burgers" });
     return Json(JsonConvert.SerializeObject(foodList));
 }
 Character.Stats TasteToStats.tasteToStats(Food food)
 {
     Character.Stats statsToReturn = new Character.Stats();
     statsToReturn.MaxHP += food.foodTaste.umami;
     statsToReturn.AttackSpeed += food.foodTaste.bitter;
     statsToReturn.MovementSpeed += food.foodTaste.bitter;
     return statsToReturn;
 }
Example #15
0
        public Arena(int width, int height)
        {
            Width = width;
            Height = height;

            Cells = new Food[width, height];

            Snake = new SnakeModel(this);
        }
Example #16
0
        /// <summary>
        /// Feeds the specified food.
        /// </summary>
        /// <param name="food">The food.</param>
        /// <exception cref="System.ArgumentException">Cats can only eat CatFood</exception>
        public override void Feed(Food food)
        {
            if (!(food is CatFood))
            {
                throw new ArgumentException("Cats can only eat CatFood");
            }

            this.IsHungry = false;
        }
Example #17
0
 public void EditFood(int id, Food food)
 {
     Food f = db.Foods.Find(id);
     f.CategaryId = food.CategaryId;
     f.Name = food.Name;
     f.Price = food.Price;
     f.Detail = food.Detail;
     db.SaveChanges();
 }
Example #18
0
 public void calculateForagingMotion(List<Krill> herd, HerdParameters parameters, Food food)
 {
     foreach(Krill krill in herd){
          Position oldForaging = krill.getForagingMotion() * parameters.inertiaForagingWeight;
          Position betaPosition = betaCalculator.calculateBeta(krill,food,parameters);
          betaPosition = betaPosition * parameters.Vf;
          krill.setForagingMotion(betaPosition + oldForaging);
      }
 }
 Character.Stats TasteToStats.tasteToStats(Food food)
 {
     Character.Stats statsToReturn = new Character.Stats();
     statsToReturn.MaxHP += food.foodTaste.umami;
     statsToReturn.CurrHP += food.foodTaste.spicy;
     statsToReturn.AttackDamage += food.foodTaste.spicy;
     statsToReturn.AttackSpeed += food.foodTaste.spicy;
     statsToReturn.MovementSpeed += food.foodTaste.spicy;
     return statsToReturn;
 }
Example #20
0
 public override void HandleFood(Food food)
 {
     if(food.Name == "Cappuccino")
     {
       Console.WriteLine("GirlFriend: My lovely cappuccino!!!");
       return;
     }
       // Базовий виклик base.HandleFood(food) для останнього обробітника-дівчини
       // не має сенсу, тому можна викинути ексепшин або нічого не робити
 }
Example #21
0
 public AddFoodViewModel()
 {
     _isCanceled = false;
     Participants = new ObservableCollection<IParticipant>();
     SelectedParticipants = new ObservableCollection<IParticipant>();
     AvailableFood = new ObservableCollection<FoodItemViewModel>();
     FillFood();
     Food = new Food();
     SelectedFoodItem = AvailableFood[0];
     InitLabels();
 }
Example #22
0
 public void Food_TestMe()
 {
     Food m = new Food()
     {
     Name = Guid.NewGuid().ToString(),
     UnitMeasurement = Guid.NewGuid().ToString(),
     StoreAmount = 0.0M,
     Category = Guid.NewGuid().ToString(),
     }
     ;
     m.TestMe();
 }
Example #23
0
    public void OnDrop(PointerEventData eventData)
    {
        foodServed = eventData.pointerDrag.GetComponent<Food> ();

        if (foodServed != null) {

            foodServed.parentToReturnTo = this.transform;

            CheckAnswer(foodServed);

        }
    }
Example #24
0
 public void AddFood(Food f)
 {
     cmd = new SqlCommand("insert into FoodTbl values(@fname,@price,@fpic,@des,@isactive)", con);
     cmd.Parameters.AddWithValue("@fname", f.foodname);
     cmd.Parameters.AddWithValue("@price", f.price);
     cmd.Parameters.AddWithValue("@fpic", f.foodpic);
     cmd.Parameters.AddWithValue("@des", f.descrip);
     cmd.Parameters.AddWithValue("@isactive", f.isactive);
     con.Open();
     cmd.ExecuteNonQuery();
     con.Close();
 }
Example #25
0
 public void Cook()
 {
     //烹飪一道食物
     Food newFood = new Food();
     if (CookingSlots.Count < MaxCookingSlots)
     {
         // 還有烹飪的空位
         Debug.Log ("Start new cook");
         CookingSlots.Add(newFood);
         newFood.StartTimer();
         RefreshInfoText();
     }
 }
Example #26
0
 /// <summary>
 /// Feeds the specified food.
 /// </summary>
 /// <param name="food">The food.</param>
 public override void Feed(Food food)
 {
     // Dog's will eat anything
     // but only DogFood will satisfy!
     if(food is DogFood)
     {
         this.IsHungry = false;
     }
     else
     {
         this.IsHungry = true;
     }
 }
Example #27
0
 public void AddNewFoodAndPoison(int n)
 {
     for (int i = 0; i < n; i++)
     {
         Foods.Add(new Food());
         Foods[i] = new Food();
     }
     for (int i = 0; i < n; i++)
     {
         Poisons.Add(new Poison());
         Poisons[i] = new Poison();
     }
 }
Example #28
0
    private void Eat(Food food)
    {
        food.GetComponent<Collider>().enabled = false;
        Destroy(food.gameObject, 2);
        movement.enabled = false;
        aggroCollider.gameObject.SetActive(false);

        --consumeCount;
        if (consumeCount <= 0)
            Destroy(gameObject, 2);
        else
            Invoke("Resume", 2);
    }
Example #29
0
 public void RefreshInfoText(Food cookingOne = null)
 {
     if (cookingOne != null)
     {
         CookingNameText.text = cookingOne.Name;
         CookingTimeLeftText.text = cookingOne.TimeLeft.ToString();
         CookingWaitingText.text = (CookingSlots.Count - 1).ToString();
     } else {
         CookingNameText.text = "";
         CookingTimeLeftText.text = "";
         CookingWaitingText.text = "";
     }
     StockInfoText.text = Stock.Count.ToString();
 }
 public Food GetClosestFood(List<Food> food, Vector2 Start)
 {
     Food ClosestFood = new Food(Bounds);
     double Closest = 320000;
     foreach (Food f in food)
     {
         if (GetDistance(Start, f.position) < Closest)
         {
             Closest = GetDistance(Start, f.position);
             ClosestFood = f;
         }
     }
     return ClosestFood;
 }
Example #31
0
 public void AddFood(Food data)
 {
     Debug.Log("Player --" + data.name + "scorevalue " + data.poopValue);
     EventManager.TriggerEvent("SCORED_PLAYER" + playerID);
     score = data.poopValue;
 }
 public void Add(Food food) =>
 Food.Add(food);
 public async Task UpdateFood(Food f)
 {
     await _connection.UpdateAsync(f);
 }
Example #34
0
        /// <summary>
        /// 根据aId取对应模板的店铺表的storeId
        /// </summary>
        /// <param name="aId"></param>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        public int ReturnStoreIdByAId(int aId, ref string errorMsg, ref string aids, ref string userIds, string telephone = "")
        {
            aids = aId.ToString();
            //店铺ID
            int storeId = 0;
            XcxAppAccountRelation xcxrelation = base.GetModel(aId);

            if (xcxrelation == null)
            {
                errorMsg = "未找到小程序授权资料";
                return(storeId);
            }
            XcxTemplate xcxTemplate = XcxTemplateBLL.SingleModel.GetModel(xcxrelation.TId);

            if (xcxTemplate == null)
            {
                errorMsg = "未找到小程序的模板";
                return(storeId);
            }

            switch (xcxTemplate.Type)
            {
            case (int)TmpType.小程序餐饮模板:
                Food store_Food = FoodBLL.SingleModel.GetModel($" appId = {xcxrelation.Id} ");
                if (store_Food == null)
                {
                    errorMsg = "还未开通店铺";
                    return(storeId);
                }
                storeId = store_Food.Id;
                break;

            case (int)TmpType.小程序多门店模板:
                FootBath store_MultiStore = FootBathBLL.SingleModel.GetModel($" appId = {xcxrelation.Id} and HomeId = 0 ");
                if (store_MultiStore == null)
                {
                    errorMsg = "还未开通店铺";
                    return(storeId);
                }
                storeId = store_MultiStore.Id;
                break;

            case (int)TmpType.小程序电商模板:
            case (int)TmpType.小程序专业模板:
                Store store = StoreBLL.SingleModel.GetModelByRid(xcxrelation.Id);
                if (store == null)
                {
                    errorMsg = "还未开通店铺";
                    return(storeId);
                }
                storeId = store.Id;
                break;

            case (int)TmpType.小未平台子模版:
                PlatStore platstore = PlatStoreBLL.SingleModel.GetModelByAId(xcxrelation.Id);
                if (platstore == null)
                {
                    errorMsg = "还未开通店铺";
                    return(storeId);
                }
                storeId = platstore.Id;
                break;

            case (int)TmpType.小未平台:
                storeId = -999;
                List <PlatStore> storeList = PlatStoreBLL.SingleModel.GetXcxRelationAppids(xcxrelation.Id);
                if (storeList != null && storeList.Count > 0)
                {
                    aids = aId + "," + string.Join(",", storeList.Select(s => s.Aid));
                    string            appids       = "'" + string.Join("','", storeList.Select(s => s.AppId)) + "'";
                    List <C_UserInfo> userInfoList = C_UserInfoBLL.SingleModel.GetListByAppIds(telephone, appids);
                    if (userInfoList == null || userInfoList.Count <= 0)
                    {
                        return(storeId);
                    }
                    userIds += "," + string.Join(",", userInfoList.Select(s => s.Id));
                }

                break;

            default:
                errorMsg = "还未开通店铺";
                return(storeId);
            }
            return(storeId);
        }
Example #35
0
 //parameter food 의 가격을 리턴함
 private int getFoodPrice(Food food)
 {
     return((App.foodData.listFood.Where(x => x.Name == food.Name).ToList())[0].Price);
 }
Example #36
0
 public EatEntry(Mobile from, Food food) : base(6135, 1)
 {
     m_From = from;
     m_Food = food;
 }
Example #37
0
 // POST values
 public int Post([FromBody] Food value)
 {
     return(bl.InsertOrUpdateFood(value));
 }
Example #38
0
        public async Task <IActionResult> Delete([FromBody] Food food)
        {
            await _foodService.Delete(food);

            return(Ok());
        }
 public EnterNewFoodBase()
 {
     NewFood = new Food();
 }
Example #40
0
    /** \endcond */

    /**
     * \brief Set the food of this dish.
     * @param food: a GameObject with a Food component attached
     */
    public void SetFood(Food food)
    {
        myFood = food;        //gameObject.GetComponentsInChildren<Food>()[0];
    }
Example #41
0
 public override void Eat(Food food)
 {
     this.Weight    += food.Quantity * foodIncrease;
     this.FoodEaten += food.Quantity;
 }
Example #42
0
 public void BecameRottenFood(Food targetFood)
 {
     //푸드팩토리에서 음식이 상하지 않는다
     //상한 식량이 생기면 신선도를 초기화 한다
     targetFood.ResetFreshness();
 }
Example #43
0
            public void DeleteFood(int food)
            {
                Food f = c.foods.Select(x => x).Where(x => x.FoodID == food).First();

                c.foods.Remove(f);
            }
Example #44
0
 public override void FeedAnimal(Food food)
 {
     base.Eat(food, new List <string> {
         nameof(Meat)
     }, weightToGain);
 }
        public void Run()
        {
            string input = string.Empty;

            while ((input = Console.ReadLine()) != "End")
            {
                try
                {
                    string[] animalInfo = input
                                          .Split(" ", StringSplitOptions.RemoveEmptyEntries);

                    string[] foodInfo = Console.ReadLine()
                                        .Split(" ", StringSplitOptions.RemoveEmptyEntries);

                    string animalType = animalInfo[0];
                    string name       = animalInfo[1];
                    double weight     = double.Parse(animalInfo[2]);

                    if (animalType == "Hen" || animalType == "Owl")
                    {
                        double wingSize = double.Parse(animalInfo[3]);

                        animal = this.birdFactory.CreateBird(animalType,
                                                             name, weight, wingSize);
                    }
                    else if (animalType == "Mouse" || animalType == "Dog")
                    {
                        string livingRegion = animalInfo[3];

                        animal = this.mammalFactory.CreateMammal(animalType,
                                                                 name, weight, livingRegion);
                    }
                    else if (animalType == "Cat" || animalType == "Tiger")
                    {
                        string livingRegion = animalInfo[3];
                        string breed        = animalInfo[4];

                        animal = this.felineFactory.CreateFeline(animalType,
                                                                 name, weight, livingRegion, breed);
                    }

                    string foodType     = foodInfo[0];
                    int    foodQuantity = int.Parse(foodInfo[1]);

                    food = this.foodFactory.CreateFood(foodType, foodQuantity);

                    animal.ProduceSound();
                    animal.Eat(food);
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex.Message);
                }

                animals.Add(animal);
            }

            foreach (var animal in animals)
            {
                Console.WriteLine(animal);
            }
        }
Example #46
0
 public void InsertFood(Food food)
 {
     food.FoodID = c.foods.Count();
     c.foods.Add(food);
     food.FoodID = c.foods.Count();
 }
Example #47
0
 public virtual void Feed(Food food)
 {
 }
Example #48
0
 public ShoppingVoucher(Country country, HotelClass hotelClass, Food food, double price) : base(country, hotelClass, food, price)
 {
     TypeOfVoucher = TypeOfVoucher.shopping;
 }
Example #49
0
 public IActionResult SaveFood([FromBody] Food food)
 {
     food.Id = Guid.NewGuid().ToString();
     return(this.Ok(food));
 }
Example #50
0
 public async Task <int> CreateProductAsync(Food newProduct)
 {
     return(await this._productRepos.CreateProductAsync(newProduct));
 }
 public abstract void Eat(Food food);
Example #52
0
 public override void TimeToEat(Food food, int quantity)
 {
     this.Weight    += (weightIncreaseBy * quantity);
     this.FoodEaten += quantity;
 }
 public async Task DeleteFood(Food f)
 {
     await _connection.DeleteAsync(f);
 }
Example #54
0
 public DroppedFood(int foodHash, Food food)
 {
     this.foodHash = foodHash;
     this.food     = food;
 }
Example #55
0
 public override void awakeInit()
 {
     // this.memoryFoodLocations = new Dictionary<string,Vector3>();
     realFoodType = Food.getFoodTypeFromEnum(foodType);
 }
 public Task SaveFood(Food food)
 {
     return(_elasticClient.IndexDocumentAsync <Food>(food));
 }
 protected override void OnInitialized()
 {
     NewFood = new Food();
     base.OnInitialized();
 }
Example #58
0
 private OrderLineViewModel GetExistingOrderLineByFoodId(Food food)
 {
     return(OrderViewModel.OrderLines.SingleOrDefault(ol => ol.Food == food));
 }
Example #59
0
 public bool InputFood(Food targetObject)
 {
     //재료를 집어넣는 기능?
     throw new System.NotImplementedException();
 }
Example #60
0
            public void UpdateFood(Food food)
            {
                Food f = c.foods.Where(x => x.FoodID == food.FoodID).First();

                f.Name = food.Name;
            }