public static GameObject CreateCritter( string id, string name, string desc, string anim_file, bool is_baby) { GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(BaseDreckoConfig.BaseDrecko(id, name, desc, anim_file, BASE_TRAIT_ID, is_baby, (string)null, 308.15f, 363.15f), DreckoTuning.PEN_SIZE_PER_CREATURE); CreateTrait(name); Diet diet = new Diet(new Diet.Info[1] { new Diet.Info(new HashSet <Tag>() { (Tag)SeaLettuceConfig.ID }, AlgaeDrecko.POOP_ELEMENT, AlgaeDrecko.CALORIES_PER_DAY_OF_PLANT_EATEN, AlgaeDrecko.KG_POOP_PER_DAY_OF_PLANT, (string)null, 0.0f, false, true) }); CreatureCalorieMonitor.Def def1 = wildCreature.AddOrGetDef <CreatureCalorieMonitor.Def>(); def1.diet = diet; def1.minPoopSizeInCalories = AlgaeDrecko.MIN_POOP_SIZE_IN_CALORIES; wildCreature.AddOrGetDef <SolidConsumerMonitor.Def>().diet = diet; ScaleGrowthMonitor.Def def2 = wildCreature.AddOrGetDef <ScaleGrowthMonitor.Def>(); def2.defaultGrowthRate = (float)(1.0 / (double)AlgaeDrecko.SCALE_GROWTH_TIME_IN_CYCLES / 600.0); def2.dropMass = AlgaeDrecko.FIBER_PER_CYCLE * AlgaeDrecko.SCALE_GROWTH_TIME_IN_CYCLES; def2.itemDroppedOnShear = AlgaeDrecko.EMIT_ELEMENT; def2.levelCount = 6; def2.targetAtmosphere = SimHashes.CarbonDioxide; return(wildCreature); }
public void ShouldAddMealToDiet() { Diet diet = GetNewDiet(); Meal meal = diet.AddMeal("Breakfast", "A faster breakfast", new Time(9, 0, 0)); Assert.AreEqual(1, diet.MealCount); }
public async Task <bool> EditDietAsync(DietSocketsModel diet) { using (ShapeAppDbContext ctx = new ShapeAppDbContext()) { Diet dietDb = await ctx.Diet.FirstAsync(d => d.Id == diet.Id); if (!string.IsNullOrEmpty(diet.Title)) { dietDb.Title = diet.Title; } if (!string.IsNullOrEmpty(diet.Description)) { dietDb.Description = diet.Description; } dietDb.IsPublic = diet.Global; try { ctx.Diet.Update(dietDb); await ctx.SaveChangesAsync(); } catch (Exception e) { return(false); } return(true); } }
private void OnCollisionEnter(Collision collision) { if (Diet == null || CompareTag("plant")) { return; } if (collision.gameObject.CompareTag("wall")) { Ai.SetState(AI.State.Searching); return; } if (Diet.Contains(collision.gameObject.tag)) { //Debug.Log("found food: " + collision.gameObject); //Instantiate(particle, collision.gameObject.transform.position, Quaternion.identity); //collision.gameObject.SetActive(false); //Destroy(collision.gameObject, Random.Range(2f, 10f)); collision.gameObject.GetComponent <Entity>().Die(); Hunger -= nutrition; if (Hunger <= 0f) { //Instantiate(gameObject); GameManager.Resurrect(gameObject.tag, gameObject.transform); Hunger = 8f; } Ai.ClearState(); } else { Ai.ClearState(); } }
public async Task <bool> DeleteAsync(int id) { _logger.LogInformation("Entered in Delete with id {}", id); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); Diet dietFromDb = await _ctx.Diets.FindAsync(id); if (dietFromDb == null) { stopWatch.Stop(); _logger.LogInformation("Elapsed time in {0} ms", stopWatch.ElapsedMilliseconds); _logger.LogError("Diet with id {} not found", id); return(false); } _ctx.Diets.Remove(dietFromDb); await _ctx.SaveChangesAsync(); stopWatch.Stop(); _logger.LogInformation("Elapsed time in {0} ms", stopWatch.ElapsedMilliseconds); return(true); }
public async Task <Diet> Create(Diet diet) { List <Task> tasks = new List <Task>(); var planIdExists = _planRepository.GetById(diet.SuitablePlanId); tasks.Add(planIdExists); var uniqueId = _dietRepository.GetById(diet.Id); tasks.Add(uniqueId); var uniqueName = _dietRepository.GetByName(diet.Name); tasks.Add(uniqueName); await Task.WhenAll(tasks); if (planIdExists.Result != null && uniqueId.Result == null && uniqueName.Result == null) { return(await _dietRepository.Create(diet)); } else { throw new Exception(); } }
public void NewIndividual(int memberId, float startSize, float startSpeed, float startSense, Diet startingDiet) { id = memberId; size = startSize; speed = startSpeed; sense = startSense; AteToday = false; TimesEatenToday = 0; BornToday = false; HasBeenEatenToday = false; male = UnityEngine.Random.Range(0, 2) != 0; diet = startingDiet; energy = 10000; scanning = false; //set wander speed and navMesh speed gameObject.GetComponentInChildren <Wander>().speed = speed * 50; gameObject.GetComponentInChildren <NavMeshAgent>().speed = speed * 50; //calc energy cost double speedCost = (speed * 5); double sizeCost = (size * 5); double senseCost = (sense * 5); totalEnergyCost = (float)(Math.Pow(sizeCost, 2) * Math.Pow(speedCost, 2) + senseCost); MeshRenderer renderer = gameObject.GetComponent <MeshRenderer>(); //var currentColor = renderer.material.color; renderer.material.color = new Color(size, speed, sense); gameObject.transform.localScale = new Vector3(size * 2, size * 2, size * 2); }
public static bool CanEat(AnimalSize size, Diet diet, AnimalSize foodSize, Diet foodDiet) { if (diet.type == DietType.Herbivores) { if (foodDiet.type == DietType.None) { return(true); } else { return(false); } } if (diet.type == DietType.Carnivorous) { if (foodDiet.type == DietType.Herbivores && foodSize.value <= (size.value - 1.5f)) { return(true); } if (foodDiet.type == DietType.Carnivorous && foodSize.value <= (size.value - 2)) { return(true); } else { return(false); } } return(false); }
public Wagon(Diet compDiet, Size compSize) { Capacity = 10; Animals = new List <Animal>(); CompatibleDiet = compDiet; CompatibleSize = compSize; }
public async Task <IActionResult> PutDiet([FromRoute] int id, [FromBody] Diet diet) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != diet.DietId) { return(BadRequest()); } _context.Entry(diet).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DietExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Create(Diet diet) { if (ModelState.IsValid) { foreach (var idFood in diet.IdFoods) { diet.Foods.Add(_dairyFarmService.GetFoodById(idFood)); } foreach (var idCattleType in diet.IdCattleTypes) { diet.CattleTypes.Add(_dairyFarmService.GetCattleTypeById(idCattleType)); } var popup = new MessageInfo { State = 1, Message = "Regime bien ajouté" }; if (_dairyFarmService.AddDiet(diet) == false) { return(RedirectToAction("Index", "Diets", new { message = "Erreur dans l'ajout", state = 0 })); } return(RedirectToAction("Index", "Diets", new { message = popup.Message, state = popup.State })); } return(RedirectToAction("Index", "Diets", new { message = "Erreur dans l'ajout", state = 0 })); }
public ActionResult Edit(Diet diet) { if (ModelState.IsValid) { diet.Foods.Clear(); diet.CattleTypes.Clear(); foreach (var idFood in diet.IdFoods) { diet.Foods.Add(_dairyFarmService.GetFoodById(idFood)); } foreach (var idCattleType in diet.IdCattleTypes) { diet.CattleTypes.Add(_dairyFarmService.GetCattleTypeById(idCattleType)); } diet.IdSeason = diet.IdSeason; diet.Label = diet.Label; var popup = new MessageInfo { State = 1, Message = "Regime bien édité" }; if (_dairyFarmService.EditDiet(diet) == false) { return(RedirectToAction("Index", "Diets", new { message = "Erreur dans l'édition", state = 0 })); } return(RedirectToAction("Index", "Diets", new { id = popup.Id, message = popup.Message, state = popup.State })); } return(RedirectToAction("Index", "Diets", new { message = "Erreur dans l'édition", state = 0 })); }
public AnimalType(string animal, double ratio, Diet diet, double meatPercent = 0) { Animal = animal; Ratio = ratio; Diet = diet; MeatPercent = meatPercent; }
public Npc(Diet diet, BodyMass bodyMass) { DietHabits = diet; MassSize = bodyMass; SetNpcBaseSettings(); }
//Initilization protected override void Start() { //start living entity base class base.Start(); startingHealth = baseHealth; switch (dietinfo) { case 'h': dietType = Diet.Herbivorous; break; case 'o': dietType = Diet.Omnivorous; break; case 'p': dietType = Diet.Carnivorous; break; } //Action marker setup skinDefalt = GetComponent<Renderer>().material; defaltColor = skinDefalt.color; //navagation set up pathfinder = GetComponent<NavMeshAgent>(); pathfinder.acceleration = acceleration; pathfinder.speed = movmentSpeed; currentState = State.Idle; currentTargetList = new List<Transform>(); currentTargetType = targetType.Water; //Combat set up animatCombat = GetComponent<Combat>(); attackDistanceThreshold = attackRange / 1.2f; animatCombat.SetStats(attackRange, attackAccuracy, attackDamage); //Sence Components set up //sight animatSight = GetComponent<Sight>(); animatSight.SetStats(sightRange); //olfaction animatOlfaction = GetComponent<Olfaction>(); animatOlfaction.SetStats(olfactionRange, olfactionAccuracy); //audition animatAudition = GetComponent<Audition>(); animatAudition.SetStats(hearingRange); //Metabolism hunger = (int)(baseSatation/1.5); thirst = (int)(baseHydration/1.5); StartCoroutine(Metabolism()); //Cognition spawnOrigin = GetComponentInParent<Spawner>(); noOfTargetsConsumed = 0; StartCoroutine(DecisionBlock()); StartCoroutine(ActionBlock()); }
public static void SubtractNutrients(Product entity, Diet diet) { diet.TotalCalories -= entity.Calories; diet.TotalCarbohydrates -= entity.Carbohydrates; diet.TotalFats -= entity.Fats; diet.TotalProteins -= entity.Proteins; }
public Customer(int personNumber, string name, Diet diet) { PersonNumber = personNumber; Name = name; Order = new Order(); Diet = diet; }
public async Task <DietDto> UpdateAsync(int id, DietDto entity) { _logger.LogInformation("Entered in Update with id {}, dietDto {}", id, entity); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); Diet dietFromDb = await _ctx.Diets.FindAsync(id); if (dietFromDb == null) { stopWatch.Stop(); _logger.LogInformation("Elapsed time in {0} ms", stopWatch.ElapsedMilliseconds); _logger.LogError("Diet with id {} not found", id); return(null); } Diet dietToUpdate = _mapper.Map <DietDto, Diet>(entity); _ctx.Entry(dietFromDb).CurrentValues.SetValues(dietToUpdate); await _ctx.SaveChangesAsync(); await _patientRepository.DisassociateDietAsync(id); entity.PatientDto.DietId = dietToUpdate.Id; await _patientRepository.UpdateAsync(entity.PatientDto.Id, entity.PatientDto); stopWatch.Stop(); _logger.LogInformation("Elapsed time in {0} ms", stopWatch.ElapsedMilliseconds); return(_mapper.Map <Diet, DietDto>(dietToUpdate)); }
public Animal(int animalId, string animalName, Diet animalDiet, Size animalSize) { AnimalId = animalId; Name = animalName; Diet = animalDiet; Size = animalSize; }
public async Task <DietDto> GetAsync(int id) { _logger.LogInformation("Entered in Get with id {}", id); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); Diet diet = await _ctx.Diets.Include(d => d.DietMeal).FirstOrDefaultAsync(d => d.Id == id); if (diet == null) { stopWatch.Stop(); _logger.LogInformation("Elapsed time in {0} ms", stopWatch.ElapsedMilliseconds); _logger.LogError("Diet with id {} not found", id); return(null); } Patient patientFromDb = await _ctx.Patients.Include(p => p.Diet).FirstOrDefaultAsync(p => p.DietId == id); PatientDto patientDto = _mapper.Map <Patient, PatientDto>(patientFromDb); DietDto dietDto = new DietDto { PatientDto = patientDto }; stopWatch.Stop(); _logger.LogInformation("Elapsed time in {0} ms", stopWatch.ElapsedMilliseconds); return(_mapper.Map <Diet, DietDto>(diet, dietDto)); }
/// <summary> /// Checks to see if the item can be eaten by a critter. /// </summary> /// <param name="item">The item to check.</param> /// <param name="diet">The critter's diet.</param> /// <returns>true if the item is edible, or false otherwise.</returns> private static bool CanEatItem(KMonoBehaviour item, Diet diet) { bool edible = false; if (item.TryGetComponent(out KPrefabID pid) && (edible = CanEatItem(pid, diet)) && pid.HasAnyTags_AssumeLaundered(ref SolidConsumerMonitor.plantMask)) { float grown = 0.0f; // Trees are special cased in the Klei code if (item.TryGetComponent(out BuddingTrunk trunk)) { grown = trunk.GetMaxBranchMaturity(); } else { var maturity = Db.Get().Amounts.Maturity.Lookup(item); if (maturity != null) { grown = maturity.value / maturity.GetMax(); } } // Could not find this hardcoded constant in the Klei code if (grown < 0.25f) { edible = false; } } return(edible); }
public Orderlist(List<DayMenu> dayMenus, DateTime startDate, DateTime endDate, Diet diet) { DayMenus = dayMenus; StartDate = startDate; EndDate = endDate; Diet = diet; }
public static GameObject CreateDrecko(string id, string name, string desc, string anim_file, bool is_baby) { GameObject prefab = BaseDreckoConfig.BaseDrecko(id, name, desc, anim_file, "DreckoBaseTrait", is_baby, "fbr_", 308.15f, 363.15f); prefab = EntityTemplates.ExtendEntityToWildCreature(prefab, DreckoTuning.PEN_SIZE_PER_CREATURE, 150f); Trait trait = Db.Get().CreateTrait("DreckoBaseTrait", name, name, null, false, null, true, true); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, DreckoTuning.STANDARD_STOMACH_SIZE, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - DreckoTuning.STANDARD_CALORIES_PER_CYCLE) / 600f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 150f, name, false, false, true)); HashSet <Tag> hashSet = new HashSet <Tag>(); hashSet.Add("SpiceVine".ToTag()); hashSet.Add(SwampLilyConfig.ID.ToTag()); hashSet.Add("BasicSingleHarvestPlant".ToTag()); Diet.Info[] infos = new Diet.Info[1] { new Diet.Info(hashSet, POOP_ELEMENT, CALORIES_PER_DAY_OF_PLANT_EATEN, KG_POOP_PER_DAY_OF_PLANT, null, 0f, false, true) }; Diet diet = new Diet(infos); CreatureCalorieMonitor.Def def = prefab.AddOrGetDef <CreatureCalorieMonitor.Def>(); def.diet = diet; def.minPoopSizeInCalories = MIN_POOP_SIZE_IN_CALORIES; SolidConsumerMonitor.Def def2 = prefab.AddOrGetDef <SolidConsumerMonitor.Def>(); def2.diet = diet; ScaleGrowthMonitor.Def def3 = prefab.AddOrGetDef <ScaleGrowthMonitor.Def>(); def3.defaultGrowthRate = 1f / SCALE_GROWTH_TIME_IN_CYCLES / 600f; def3.dropMass = FIBER_PER_CYCLE * SCALE_GROWTH_TIME_IN_CYCLES; def3.itemDroppedOnShear = EMIT_ELEMENT; def3.levelCount = 6; def3.targetAtmosphere = SimHashes.Hydrogen; return(prefab); }
public async Task <bool> DeleteDietAsync(int dietId) { using (ShapeAppDbContext ctx = new ShapeAppDbContext()) { try { Diet diet = await ctx.Diet.FirstAsync(d => d.Id == dietId); List <Meal> mealsForDiet = ctx.DietMeals.Where(dm => dm.DietId == dietId) .Select(dm => dm.Meal).ToList(); foreach (var meal in mealsForDiet) { if (GetNumberOfDietsForMeal(meal.Id) == 1) { ctx.Meal.Remove(meal); } } ctx.Diet.Remove(diet); await ctx.SaveChangesAsync(); } catch (Exception e) { return(false); } return(true); } }
public void ModifyDiet(Cat cat) { if (Equals(null, _model)) { return; } _dietInProgress = new List <Nom>(cat.NomsAsList); Diet dlg = new Diet(this, cat, _dietInProgress); try { if (DialogResult.OK == dlg.ShowDialog()) { cat.NomsICanEat.Clear(); foreach (Nom nom in _dietInProgress) { cat.NomsICanEat.Add(nom); } _model.SaveObject <Cat>(cat); } } finally { dlg.Close(); } }
public static GameObject CreateMole(string id, string name, string desc, string anim_file, bool is_baby = false) { GameObject gameObject = BaseMoleConfig.BaseMole(id, name, STRINGS.CREATURES.SPECIES.MOLE.DESC, "MoleBaseTrait", anim_file, is_baby); gameObject.AddTag(GameTags.Creatures.Digger); EntityTemplates.ExtendEntityToWildCreature(gameObject, MoleTuning.PEN_SIZE_PER_CREATURE, 100f); Trait trait = Db.Get().CreateTrait("MoleBaseTrait", name, name, null, false, null, true, true); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, MoleTuning.STANDARD_STOMACH_SIZE, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - MoleTuning.STANDARD_CALORIES_PER_CYCLE) / 600f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 100f, name, false, false, true)); List <Tag> list = new List <Tag>(); list.Add(SimHashes.Regolith.CreateTag()); list.Add(SimHashes.Dirt.CreateTag()); list.Add(SimHashes.IronOre.CreateTag()); List <Diet.Info> list2 = BaseMoleConfig.SimpleOreDiet(list, CALORIES_PER_KG_OF_DIRT, TUNING.CREATURES.CONVERSION_EFFICIENCY.NORMAL); Diet diet = new Diet(list2.ToArray()); CreatureCalorieMonitor.Def def = gameObject.AddOrGetDef <CreatureCalorieMonitor.Def>(); def.diet = diet; def.minPoopSizeInCalories = MIN_POOP_SIZE_IN_CALORIES; SolidConsumerMonitor.Def def2 = gameObject.AddOrGetDef <SolidConsumerMonitor.Def>(); def2.diet = diet; OvercrowdingMonitor.Def def3 = gameObject.AddOrGetDef <OvercrowdingMonitor.Def>(); def3.spaceRequiredPerCreature = 0; gameObject.AddOrGet <LoopingSounds>(); return(gameObject); }
public static void Postfix(GameObject __result) { if (!Patches.Settings.DisableLonghairSlicksters) { // Patch the diet Diet diet = new Diet(new Diet.Info[] { new Diet.Info(new HashSet <Tag> { SimHashes.Oxygen.CreateTag() }, ((SimHashes)Patches.Settings.LonghairElement).CreateTag(), Traverse.Create <OilFloaterDecorConfig>().GetField <float>("CALORIES_PER_KG_OF_ORE"), TUNING.CREATURES.CONVERSION_EFFICIENCY.GOOD_1, null, 0, false, false) }); CreatureCalorieMonitor.Def def = __result.AddOrGetDef <CreatureCalorieMonitor.Def>(); def.diet = diet; __result.AddOrGetDef <GasAndLiquidConsumerMonitor.Def>().diet = diet; // Patch the dead drop string[] loot = new string[4]; loot[0] = BasicFabricConfig.ID; loot[1] = BasicFabricConfig.ID; loot[2] = MeatConfig.ID; loot[3] = MeatConfig.ID; __result.AddOrGet <Butcherable>().SetDrops(loot); } }
public Diet GetNewDiet() { Guid profileId = Guid.NewGuid(); Diet diet = new Diet(profileId, "Nova Dieta", "Dieta Low Carb"); return(diet); }
public ActionResult Create([Bind(Include = "Id,Name,Subscription")] Diet diet) { var ChoosenArr = Request.Cookies[namecookies]?.Value?.Split(','); int[] arr = Array.ConvertAll(ChoosenArr, s => int.Parse(s)); if (ModelState.IsValid && arr != null) { try { db.Diet.Add(diet); db.SaveChanges(); int Id_Add = (from i in db.Diet orderby i.Id descending select i).ToList()[0].Id; db.Diet.FirstOrDefault(i => i.Id == Id_Add).AddDishes(arr); db.SaveChanges(); } catch (Exception ex) { string e = ex.Message; ModelState.AddModelError("", "There is the same name "); return(View(diet)); } return(RedirectToAction("Index")); } ModelState.AddModelError("", "Error"); return(View(diet)); }
public static Diet Select(string nazwa, string miasto) { Diet dieta = null; KalkulatorDietyDatabase DataSet = new KalkulatorDietyDatabase(); String XML_Location = @"DataBase.xml"; DataSet.ReadXml(XML_Location); if (DataSet.Diety.Rows.Count > 0) { for (int i = 0; i < DataSet.Diety.Rows.Count; i++) { if (DataSet.Diety.Rows[i]["Nazwa diety"].ToString() == nazwa && DataSet.Diety.Rows[i]["Miasto"].ToString() == miasto) { try { dieta = new Diet(DataSet.Diety.Rows[i]["Nazwa diety"].ToString(), DataSet.Diety.Rows[i]["Miasto"].ToString(), Convert.ToDouble(DataSet.Diety.Rows[i]["Energia"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Białko"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Tłuszcze"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Węglowodany"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Sód"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Kwasy tłuszczowe nasycone"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Węglowodany przyswajalne"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Błonnik"])); } catch { dieta = new Diet(DataSet.Diety.Rows[i]["Nazwa diety"].ToString(), DataSet.Diety.Rows[i]["Miasto"].ToString(), Convert.ToDouble(DataSet.Diety.Rows[i]["Energia"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Białko"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Tłuszcze"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Węglowodany"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Sód"]), Convert.ToDouble(DataSet.Diety.Rows[i]["Kwasy tłuszczowe nasycone"]), 0, 0); } } } } return(dieta); }
public static GameObject CreateMoo(string id, string name, string desc, string anim_file, bool is_baby) { GameObject gameObject = BaseMooConfig.BaseMoo(id, name, CREATURES.SPECIES.MOO.DESC, "MooBaseTrait", anim_file, is_baby, null); EntityTemplates.ExtendEntityToWildCreature(gameObject, MooTuning.PEN_SIZE_PER_CREATURE, 75f); Trait trait = Db.Get().CreateTrait("MooBaseTrait", name, name, null, false, null, true, true); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, MooTuning.STANDARD_STOMACH_SIZE, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - MooTuning.STANDARD_CALORIES_PER_CYCLE) / 600f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 75f, name, false, false, true)); HashSet <Tag> hashSet = new HashSet <Tag>(); hashSet.Add("GasGrass".ToTag()); Diet.Info[] infos = new Diet.Info[1] { new Diet.Info(hashSet, POOP_ELEMENT, CALORIES_PER_DAY_OF_PLANT_EATEN, KG_POOP_PER_DAY_OF_PLANT, null, 0f, false, false) }; Diet diet = new Diet(infos); CreatureCalorieMonitor.Def def = gameObject.AddOrGetDef <CreatureCalorieMonitor.Def>(); def.diet = diet; def.minPoopSizeInCalories = MIN_POOP_SIZE_IN_CALORIES; SolidConsumerMonitor.Def def2 = gameObject.AddOrGetDef <SolidConsumerMonitor.Def>(); def2.diet = diet; return(gameObject); }
public LineChartCreatorTest() { TestHelper.PrepareUnitOfWork(out unitOfWork); chartCreator = new LineChartCreator(); entryPreparer = new NutrientsEntryPreparer(It.IsAny <int>()); diet = new Diet(); }
public static void AddNutrients(Product product, Diet diet) { diet.TotalCalories += product.Calories; diet.TotalCarbohydrates += product.Carbohydrates; diet.TotalFats += product.Fats; diet.TotalProteins += product.Proteins; }