So I’ve recently came back to unity after a few years and I’ve been given the task of making a tamagotchi type of game.
I’m currently working on a feeding system using real time and sliders to show the player how hungry the animal is. But I’m finding it difficult to change the slider value. basically I want the slider value to change taking the last feeding time and the next feeding time into consideration.
Once the player feeds the animal, My code saves the current time using System.DateTime.Now and saves a second time using the current time with .AddHours(4).
As an example, If the player feeds the animal at exactly 12 o’clock mid day. The next feeding time would be exactly 4 o’clock. If the player opens the game at 2 o’clock, the slider should be half filled.
I’ve tried approaching this using a few methods but haven’t had any luck.
any help would be greatly appreciated.