- Home /
Too subjective and argumentative, this requires a lot of data, this is not the place, please post it on http://forum.unity3d.com/ for a design discussion.
Unity3d School
I'm making a game where the character you are is in school. But I don't know how to check if I got to class in time. I have a clock so I know what time it is.
I'm not asking for a full script, I just need help to an idea on how to check if I made it to class before it began.
Check clock time against class start time and decide if you came on time or not based off that?
Yeah, but I wan't to have multiple classrooms so how do I check that?
Answer by Landern · Jan 01, 2015 at 11:51 AM
As the time is ticking down, i'm sure you have some event where if the player doesn't do X by some Time N, fail.
You could create a collider at the door of the class room, as the character enters the class room before Time N happens, success, otherwise fail. After which the game goes on.
This collider could be attached to cube, or just an empty game object and attach relevant scripts that check for collisions.
I could do that yes... But I'm not the best at scripting.
For the game I'm making, i wan't a whole day filled with classes.
for example:
at 9 am I have one class then at 11 am I have another class another place.
How do I check if I'm at the right place at the right time?
Is this like a persona thing... anyways.
Lets say you use the method mentioned, in the school each usable door has a collider and when you enter the collider a script method is invoked, OnCollisionEnter. You would have some game manger script that is tracking against some data structure that contains your classes, time of the classes(when you need to flag the class as entered), etc. You would iterate over that collection of that custom type checking against the clock.
I have a clock with:
Hours
$$anonymous$$inutes
Seconds
Days
Would I need to use the clock as a string?
@$$anonymous$$r$$anonymous$$elonPie, this question is probably better suited for the forums. Questions should be objective, this is beco$$anonymous$$g very subjective and enter the design/full coding area. The forum is for continuous back and forth. UA is not.
@Landern you can move ahead and close the question for the same reason.
Follow this Question
Related Questions
Clock Trigger 2 Answers
Javascript beginner here: how do I implement time such as hours and days? 2 Answers
Start my Clock script at 6am? 2 Answers
In game clock/Time 1 Answer
animation control by time/clock 2 Answers