public override void Update(float seconds) { if (!InHouse) { lbl_Food.DisplayedString = FoodQuantity.ToString(); lbl_Food.Position = Position + new Vector2f(0, 10) * shape.Scale.X; lbl_Food.Scale = shape.Scale; Find(Entities); Act(); Move(GeneticData.Speed, seconds); Energy -= DeltaEnergy * seconds; if (Energy <= 0 || Time.FinishedDay) { if (FoodQuantity > 0) { FoodQuantity--; Energy = EnergyDefault; } else { CanDispose = true; } } shape.Position = Position; shape.Rotation = (float)(Math.Atan(Facing.Y / Facing.X) * 180f / Math.PI); //rangeShape.Position = Position; } }
public List <FoodQuantity> getList(DataTable data) { List <FoodQuantity> listStatisticses = new List <FoodQuantity>(); foreach (DataRow item in data.Rows) { FoodQuantity statistics = new FoodQuantity(item); listStatisticses.Add(statistics); } return(listStatisticses); }
// DEBUG public void FeedPetFood(Food foodType) { foreach (Trait trait in StaticVariables.traitManager.allTraits) { FoodQuantity foodQuantity = new FoodQuantity(); foodQuantity.foodType = foodType; foodQuantity.foodQuantity = 1; trait.Feed(foodQuantity); } }
public bool FeedPet(FoodQuantity foodQuantity) { if (hunger < 100) { foreach (Trait trait in StaticVariables.traitManager.allTraits.OrderBy(trait => trait.GetLayer())) { trait.Feed(foodQuantity); } hunger += 10; return(true); } return(false); }
public Rabbit(Vector2f position, Vector2f facing, GeneticData data, Random rd, List <Entity> entities, Vector2f limits, WorldTime time) : base(position, facing, data, rd, limits, time) { shape = new CircleShape(Data.Genes.ActRange, 3); shape.FillColor = GetColorByData(); shape.OutlineThickness = Outline; shape.OutlineColor = OutlineColor; shape.Origin = new Vector2f(Size, Size); Entities = entities; //rangeShape = new CircleShape(data.ViewRange); //rangeShape.OutlineColor = OutlineColor; //rangeShape.OutlineThickness = Outline; //rangeShape.FillColor = RangeColor; //rangeShape.Origin = new Vector2f(data.ViewRange, data.ViewRange); Energy = EnergyDefault; lbl_Food = new Text(FoodQuantity.ToString(), DebugSimulationData.Font, 10); lbl_Food.FillColor = DebugSimulationData.FontColor; }
// Logic to run when the pet gets fed public void Feed(FoodQuantity foodFed) { // The trait's trait requirements have been met, so update the food requirement if (IsUnlocked) { if (!ActivationPointsLocked) { // Update the food requirement if (foodFed.foodType == activationFood && ActivationPoints < activationThreshold) { ActivationPoints += foodFed.foodQuantity; } else if (foodFed.foodType == detrimentalFood && ActivationPoints > 0) { ActivationPoints -= foodFed.foodQuantity; } } } ChangedActivationPoints?.Invoke(); }