- Home /
How to create an agenda or timetable system?
Hello, I know this is a very broad question, but this way I hope to get a lot of answers to choose from. We have a school assignment to create a serious/teaching game. We would like an agenda to be incorporated. Important are:
- the current time (from 0:00am to 12:00 pm, or from 0:00 to 24:00 in European measures, likely the last)
- a lot of assignments can be dynamically placed in time slots (any time... even minutes, maybe snapped to 15min intervals)
- the system keeps track of every assignment placed and checks whether it's done.
- assignments have a timespan in which the user COULD do them. So one assignment could take 15min but has a two hours-bar on the visual agenda, to give the user a choice when he wants to do it.
- if the time of an assignment has passed and it's not done the assignment is set to that status.
I think this system could work by using an array, with all assignments in key-value pairs with all data in them, that gets checked every second (or two, or max. five) But I have no clue as where to start about this in Unity.
If anyone has any good ideas to help us get started or knows a way to simplify the process, please let know...
possible key-values I can think of right now would be:
- name: name of the assignment
- fixed_time: whether this is fixed or not (if left empty, it would be an assignment the user can place him-/herself).
- duration: duration of the actual assigment
- timespan: the timespan in which the assigment could be done
- status: 0 for inactive, 1 for active, 2 for passed, 3 for failed
Cheers, and thanks to everyone who's willing to help.
Answer by duck · Dec 14, 2009 at 05:32 PM
I'm not going to be too much help with the GUI side of things, but as for the code - this sounds like you might be better off creating a Class which represents an assignment. You would then give your class these variables or properties, and add instances of your class to the timetable (unless you're wanting to store this data in a local or remote database, in which case it's a whole different question!).
You should probably also create a Timetable class, which is responsible for containing and modifying the data stored inside. If your system sticks strictly to the 'quantised' 15-minute slot system, you might have an array inside the timetable class, where each discrete cell in the array represents a 15 minute chunk of time. You could then place instances of each assignment object into these cells. An assignment could be placed into more than one cell, and you could add code which ensures they are placed in consecutive cells if that is a requirement.
You should also make sure you're aware of specific custom classes which are designed to store the type of data you're using. Such as DateTime and TimeSpan, and Enums for items like your 'status' variable.
You might be interested in reading an article I wrote which describes the differences between some of the many types of collection available to you in Unity (and Mono in general):
Unity Coding: Arrays, Hashtables and Dictionaries explained
Also, I strongly recommend you consider using the MVC pattern ("Model, View, Controller") to implement this. It's a perfect fit for problems of this nature.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Airlock Door Code Problems [Solved] 1 Answer
Setting Scroll View Width GUILayout 1 Answer
Unity3D Game Time 1 Answer
Convert Timer to HH:MM:SS 1 Answer