- Home /
Using a calendar in my game
Hello
I am currently trying to make a career mode in my game, in which you can simulate forward through dates. I currently have a calendar in my game, which works perfectly. I also have a simulate button that goes through a day per second and a button to stop simulating forward.
However I would like to allow the player to play events such as Tournaments and Exhibition Races. The Races would all be assigned a date to occur on. These dates are created at runtime, as is the calendar. When the date in the game = the date of the race, the race should occur. For example, say that I choose to have a Race on the 20th March. How can I make it so that as soon as the date = 20/3/16, it will Log a message in the console. A good example of what I am trying to do is the FIFA career mode simulation system, where every time you have an event on the calendar, the simulation stops.
Thank you
Dok
Answer by SonicScrew12 · Mar 13, 2016 at 03:33 PM
You could create a variable called "day" or "date", and increment the variable as the game time goes on. Once the variable reaches 16, run an if statement. For example,
if (date == 16) {
Debug.Log ("It's day 20!");
}
Yes, but how would I do that if these events are created at runtime and not pre-deter$$anonymous$$ed
Your answer
Follow this Question
Related Questions
How do you list all the days of the current month? 1 Answer
Get date from server? 0 Answers
Timestamp and Date from Unity? for mobile 2 Answers
calendar gui for date selection 4 Answers
Formatting Exception when using DateTime for PlayerPrefs 1 Answer