4 added 116 characters in body
source | link

Since this is Unity, I do not recommend working with XML files. The work needed to parse them is just useless. Instead, focus on creating custom editors for your scripts. This will help you in the long run.

  1. Create a script for the basic routine. In the editor of this script, you should be able to enter a location and an activity. If you want extra stuff, you may want to use some base class for routines and extend it as needed. class Routine : MonoBehaviour. A NPC will have multiple routine components, and you will choose between them depending on the current time. Identify routines by name, or something else, for each NPC. Make sure the Location and Activity properties of the routine are editable in Unity's editor. More exactly, you want to be able to select a location from the scene. That means you should be able toSleep routine for the king? Find the bed in the scene's list of objects and drag & drop it into the routine's location slot :) Pretty handy.
  2. Create a script for the schedule. Schedules map timeframes to routine scripts. Dictionary<Timeframe, Routine>.
  3. Attach a schedule to each of your NPCs. Schedules will manage the routine components that you have and will add.
  4. Create a custom editor for your schedule script so that it provides a nice and GUI-driven way to select the hours for each routine.
  5. Make a nice red glowing warning message in the editor if you haven't filled the 24 hours a NPC needs. This is useful, and will catch plenty of bugs. The same applies for empty location slots or empty activities.
  6. Add any sort of other functionality you might want, extending the editor will make it a breeze.

Extend the editor to add custom functionality. It's worth it. Don't ignore Unity's engine features by using workflows that fit other engines better.

When the player enters a level at a specific hour, you have a few choices. Spawn multiple NPCs in similar places and make them walk to their routine's location. This might look weird. Some old games did it (Gothic). Personally, I'd auto-teleport all NPCs to their routine's location when the level starts.

me.teleportAt(mySchedule.myCurrentRoutine.location);

Since this is Unity, I do not recommend working with XML files. The work needed to parse them is just useless. Instead, focus on creating custom editors for your scripts. This will help you in the long run.

  1. Create a script for the basic routine. In the editor of this script, you should be able to enter a location and an activity. If you want extra stuff, you may want to use some base class for routines and extend it as needed. class Routine : MonoBehaviour. A NPC will have multiple routine components, and you will choose between them depending on the current time. Identify routines by name, or something else, for each NPC. Make sure the Location and Activity properties of the routine are editable in Unity's editor. More exactly, you want to be able to select a location from the scene. That means you should be able to drag & drop it in the routine's location slot :) Pretty handy.
  2. Create a script for the schedule. Schedules map timeframes to routine scripts. Dictionary<Timeframe, Routine>.
  3. Attach a schedule to each of your NPCs. Schedules will manage the routine components that you have and will add.
  4. Create a custom editor for your schedule script so that it provides a nice and GUI-driven way to select the hours for each routine.
  5. Make a nice red glowing warning message in the editor if you haven't filled the 24 hours a NPC needs. This is useful, and will catch plenty of bugs.
  6. Add any sort of other functionality you might want, extending the editor will make it a breeze.

Extend the editor to add custom functionality. It's worth it. Don't ignore Unity's engine features by using workflows that fit other engines better.

When the player enters a level at a specific hour, you have a few choices. Spawn multiple NPCs in similar places and make them walk to their routine's location. This might look weird. Some old games did it (Gothic). Personally, I'd auto-teleport all NPCs to their routine's location when the level starts.

me.teleportAt(mySchedule.myCurrentRoutine.location);

Since this is Unity, I do not recommend working with XML files. The work needed to parse them is just useless. Instead, focus on creating custom editors for your scripts. This will help you in the long run.

  1. Create a script for the basic routine. In the editor of this script, you should be able to enter a location and an activity. If you want extra stuff, you may want to use some base class for routines and extend it as needed. A NPC will have multiple routine components, and you will choose between them depending on the current time. Identify routines by name, or something else, for each NPC. Make sure the Location and Activity properties of the routine are editable in Unity's editor. More exactly, you want to be able to select a location from the scene. Sleep routine for the king? Find the bed in the scene's list of objects and drag it to the routine's location slot :) Pretty handy.
  2. Create a script for the schedule. Schedules map timeframes to routine scripts. Dictionary<Timeframe, Routine>.
  3. Attach a schedule to each of your NPCs. Schedules will manage the routine components that you have and will add.
  4. Create a custom editor for your schedule script so that it provides a nice and GUI-driven way to select the hours for each routine.
  5. Make a nice red glowing warning message in the editor if you haven't filled the 24 hours a NPC needs. This is useful, and will catch plenty of bugs. The same applies for empty location slots or empty activities.
  6. Add any sort of other functionality you might want, extending the editor will make it a breeze.

Extend the editor to add custom functionality. It's worth it. Don't ignore Unity's engine features by using workflows that fit other engines better.

When the player enters a level at a specific hour, you have a few choices. Spawn multiple NPCs in similar places and make them walk to their routine's location. This might look weird. Some old games did it (Gothic). Personally, I'd auto-teleport all NPCs to their routine's location when the level starts.

me.teleportAt(mySchedule.myCurrentRoutine.location);

3 added 272 characters in body
source | link

Since this is Unity, I do not recommend working with XML files. The work needed to parse them is just useless. Instead, focus on creating custom editors for your scripts. This will help you in the long run.

  1. Create a script for the basic routine. In the editor of this script, you should be able to enter a location and an activity. If you want extra stuff, you may want to use some base class for routines and extend it as needed. class Routine : MonoBehaviour. A NPC will have multiple routine components, and you will choose between them depending on the current time. Identify routines by name, or something else, for each NPC. Make sure the Location and Activity properties of the routine are editable in Unity's editor. More exactly, you want to be able to select a location from the scene. That means you should be able to drag & drop it in the routine's location slot :) Pretty handy.
  2. Create a script for the schedule. Schedules map timeframes to routine scripts. Dictionary<Timeframe, Routine>.
  3. Attach a schedule to each of your NPCs. Schedules will manage the routine components that you have and will add.
  4. Create a custom editor for your schedule script so that it provides a nice and GUI-driven way to select the hours for each routine.  
  5. Make a nice red glowing warning message in the editor if you haven't filled the 24 hours a NPC needs. This is useful.
  6. Create slots in which you can place objects from the scene for your routine locations. The Sleep routine requires a bed. You should be able to select the exact bed you want the routine to happen at from the scene, you don't want to parse it from XML and search for it in the scenewill catch plenty of bugs.
  7. Add any sort of other functionality you might want, extending the editor will make it a breeze.

Extend the editor to add custom functionality. It's worth it. Don't ignore Unity's engine features by using workflows that fit other engines better.

When the player enters a level at a specific hour, you have a few choices. Spawn multiple NPCs in similar places and make them walk to their routine's location. This might look weird. Some old games did it (Gothic). Personally, I'd auto-teleport all NPCs to their routine's location when the level starts.

me.teleportAt(mySchedule.myCurrentRoutine.location);

Since this is Unity, I do not recommend working with XML files. The work needed to parse them is just useless. Instead, focus on creating custom editors for your scripts. This will help you in the long run.

  1. Create a script for the basic routine. In the editor of this script, you should be able to enter a location and an activity. If you want extra stuff, you may want to use some base class for routines and extend it as needed.
  2. Create a script for the schedule. Schedules map timeframes to routine scripts.
  3. Attach a schedule to each of your NPCs.
  4. Create a custom editor for your schedule script so that it provides a nice and GUI-driven way to select the hours for each routine.  
  5. Make a nice red glowing warning message if you haven't filled the 24 hours a NPC needs. This is useful.
  6. Create slots in which you can place objects from the scene for your routine locations. The Sleep routine requires a bed. You should be able to select the exact bed you want the routine to happen at from the scene, you don't want to parse it from XML and search for it in the scene.
  7. Add any sort of other functionality you might want, extending the editor will make it a breeze.

When the player enters a level at a specific hour, you have a few choices. Spawn multiple NPCs in similar places and make them walk to their routine's location. This might look weird. Personally, I'd auto-teleport all NPCs to their routine's location when the level starts.

Since this is Unity, I do not recommend working with XML files. The work needed to parse them is just useless. Instead, focus on creating custom editors for your scripts. This will help you in the long run.

  1. Create a script for the basic routine. In the editor of this script, you should be able to enter a location and an activity. If you want extra stuff, you may want to use some base class for routines and extend it as needed. class Routine : MonoBehaviour. A NPC will have multiple routine components, and you will choose between them depending on the current time. Identify routines by name, or something else, for each NPC. Make sure the Location and Activity properties of the routine are editable in Unity's editor. More exactly, you want to be able to select a location from the scene. That means you should be able to drag & drop it in the routine's location slot :) Pretty handy.
  2. Create a script for the schedule. Schedules map timeframes to routine scripts. Dictionary<Timeframe, Routine>.
  3. Attach a schedule to each of your NPCs. Schedules will manage the routine components that you have and will add.
  4. Create a custom editor for your schedule script so that it provides a nice and GUI-driven way to select the hours for each routine.
  5. Make a nice red glowing warning message in the editor if you haven't filled the 24 hours a NPC needs. This is useful, and will catch plenty of bugs.
  6. Add any sort of other functionality you might want, extending the editor will make it a breeze.

Extend the editor to add custom functionality. It's worth it. Don't ignore Unity's engine features by using workflows that fit other engines better.

When the player enters a level at a specific hour, you have a few choices. Spawn multiple NPCs in similar places and make them walk to their routine's location. This might look weird. Some old games did it (Gothic). Personally, I'd auto-teleport all NPCs to their routine's location when the level starts.

me.teleportAt(mySchedule.myCurrentRoutine.location);

2 added 272 characters in body
source | link

First, define what a routine is.

Routine {
     location;
     activity;
     //... any other details you might want to consider.
}

Then, split your NPC's schedule in pieces.

Routine from 22:00 to 7:00 - Sleep;
Routine from 7:00 to 18:00 - Work;

... and so on. These have to add up to 24 hours. If they don't, either assert or use a default routine. I'd assert, to make catching bugs easier.

Actual implementation:

Since this is Unity, I do not recommend working with XML files. The work needed to parse them is just useless. Instead, focus on creating custom editors for your scripts. This will help you in the long run.

  1. Create a script for the basic routine. In the editor of this script, you should be able to enter a location and an activity. If you want extra stuff, you may want to use some base class for routines and extend it as needed.
  2. Create a script for the schedule. Schedules map timeframes to routine scripts.
  3. Attach a schedule to each of your NPCs.
  4. Create a custom editor for your schedule script so that it provides a nice and GUI-driven way to select the hours for each routine.
  5. Make a nice red glowing warning message if you haven't filled the 24 hours a NPC needs. This is useful.
  6. Create slots in which you can place objects from the scene for your routine locations. The Sleep routine requires a bed. You should be able to select the exact bed you want the routine to happen at from the scene, you don't want to parse it from XML and search for it in the scene.
  7. Add any sort of other functionality you might want, extending the editor will make it a breeze.

When the player enters a level at a specific hour, you have a few choices. Spawn multiple NPCs in similar places and make them walk to their routine's location. This might look weird. Personally, I'd auto-teleport all NPCs to their routine's location when the level starts.

First, define what a routine is.

Routine {
     location;
     activity;
     //... any other details you might want to consider.
}

Then, split your NPC's schedule in pieces.

Routine from 22:00 to 7:00 - Sleep;
Routine from 7:00 to 18:00 - Work;

... and so on. These have to add up to 24 hours. If they don't, either assert or use a default routine. I'd assert, to make catching bugs easier.

Actual implementation:

Since this is Unity, I do not recommend working with XML files. The work needed to parse them is just useless. Instead, focus on creating custom editors for your scripts. This will help you in the long run.

  1. Create a script for the schedule.
  2. Attach a schedule to each of your NPCs.
  3. Create a custom editor for your schedule script so that it provides a nice and GUI-driven way to select the hours for each routine.
  4. Make a nice red glowing warning message if you haven't filled the 24 hours a NPC needs. This is useful.
  5. Create slots in which you can place objects from the scene for your routine locations. The Sleep routine requires a bed. You should be able to select the exact bed you want the routine to happen at from the scene, you don't want to parse it from XML and search for it in the scene.
  6. Add any sort of other functionality you might want, extending the editor will make it a breeze.

When the player enters a level at a specific hour, you have a few choices. Spawn multiple NPCs in similar places and make them walk to their routine's location. This might look weird. Personally, I'd auto-teleport all NPCs to their routine's location when the level starts.

Since this is Unity, I do not recommend working with XML files. The work needed to parse them is just useless. Instead, focus on creating custom editors for your scripts. This will help you in the long run.

  1. Create a script for the basic routine. In the editor of this script, you should be able to enter a location and an activity. If you want extra stuff, you may want to use some base class for routines and extend it as needed.
  2. Create a script for the schedule. Schedules map timeframes to routine scripts.
  3. Attach a schedule to each of your NPCs.
  4. Create a custom editor for your schedule script so that it provides a nice and GUI-driven way to select the hours for each routine.
  5. Make a nice red glowing warning message if you haven't filled the 24 hours a NPC needs. This is useful.
  6. Create slots in which you can place objects from the scene for your routine locations. The Sleep routine requires a bed. You should be able to select the exact bed you want the routine to happen at from the scene, you don't want to parse it from XML and search for it in the scene.
  7. Add any sort of other functionality you might want, extending the editor will make it a breeze.

When the player enters a level at a specific hour, you have a few choices. Spawn multiple NPCs in similar places and make them walk to their routine's location. This might look weird. Personally, I'd auto-teleport all NPCs to their routine's location when the level starts.

1
source | link