Acceptance criteria
- The hunger timer advances the animal through the required hunger states and changes its behavior.

HungerState enum in the CagedItems project.
CreateTimers methods, instantiate and start the hungerTimer, set the interval to a random time between 10 and 20 seconds, plug the HandleHungerStateChange in to the timer's Elapsed event and Start the timer.new Timer(random.Next(10, 21) * 1000);HandleHungerStateChange method, change the animal's hunger state to the next hunger state each time the timer hits it.The Tired state should not change to anything else.
Animal constructor, assign the HungerState to Satisfied as a starting point.MoveHelper's MoveVertically and MoveHorizontally methods, implement the following movement changes based on the animal's hunger state.CageWindow.xaml.cs DrawItem method, create a transform group; create the transform group before the if-statement where the item's direction is determined.TransformGroup transformGroup = new TransformGroup();HungerState is tired.SkewTransform to skew the item (animal) at a 30-degree angle.SkewTransform and set its AngleX to 30 degrees in the direction the cageable is facing.SkewTransform tiredSkew = new SkewTransform();
tiredSkew.AngleX = item.XDirection == HorizontalDirection.Left ? 30.0 : -30.0;SkewTransform to the transform group.transformGroup.Children.Add(tiredSkew);ScaleTransform to make the animal appear smaller by 75% of its width and 50% of its height.transformGroup.Children.Add(new ScaleTransform(0.75, 0.5));viewBox's RenderTransform property and instead Add the flipTransform to the transformGroup's Children.viewBox's RenderTransform property to the transformGroup object.viewBox.RenderTransform = transformGroup;If the animal is satisfied, it will move normally; if the animal is hungry, it will move as 1/4 the normal speed; if the animal is starving, it will not move; if the animal is tired, it will tip over. The movement will then stop.


OnHunger action in the HandleHungerStateChange method when the HungerState is changed to tired.feedTimer will be used to delay the automatic feeding by five seconds.CreateTimers method: instantiate the feedTimer to be 5 seconds long and plug in the HandleReadyToFeed method into the Elapsed property.CreateTimers in OnDeserialized and in the guest constructor.OnDeserialized] attribute to the OnDeSerialized method."revive" the animal and have the hungerTimer restart so let's make that happen by modifying the Animal's Eat methodEat, Stop the hungerTimer.HungerState to Satisfied.hungerTimer."subscribe" to their adopted animal's hunger change. In the AdoptedAnimal propertyOnHunger delegate to null.adoptedAnimal to the value passed in.adoptedAnimal exists, plug in the HandleAnimalHungry method to the OnHunger delegate.HandleAnimalHungry method, start the feedTimer.HandleReadyToFeed methodadoptedAnimal and pass in a new VendingMachine object.feedTimer.MainWindow, surround the code that updates the guestListBox in a Dispatcherthis.Dispatcher.Invoke(() =>
{
this.guestListBox.Items.RemoveAt(index);
this.guestListBox.Items.Insert(index, guest);
this.guestListBox.SelectedItem = this.guestListBox.Items[index];
});UpdateAnimalDisplay.Below is the basic structure of a Dispatcher Invoke. The code that needs to be executed goes in the curly braces.
this.Dispatcher.Invoke(() => { });FeedAnimal. The animal should go back to normal and begin moving again.This time, wait 5 seconds and the animal should automatically go back to normal and start moving again.


GetVendingMachine is an auto-property.ProvideVendingMachine method returns the zoo's animalSnackMachine.ProvideVendingMachine method to the GetVendingMachine func in the AddGuest method.ProvideVendingMachine method to the GetVendingMachine func in the Guest foreach loop in the OnDeserialized method.FeedAnimal method in the Guest class, call the guest's GetVendingMachine func and store the object in a variable before finding the price of the food.feedAnimal event handler, remove the zoo's AnimalSnackMachine property.Zoo class, remove the AnimalSnackMachine property.hungerTimer to fire every 1-3 seconds.© 2026 Northcentral Technical College