Possible Bug or Just Me...

Mar 10, 2010 at 8:43 AM

So I am still running through the tutorials -- I am working with the Level Changing one.  and I am trying the following code: 

base.UpdateHook(gameTime);
// if the second level is not already loaded, load it after five seconds if (!secondLevelLoaded && gameTime.TotalGameTime.Milliseconds > 5000)
{
// unload the current level Engine.DestroyDomain("CurrentLevel");
// load the second level Engine.LoadDocument("SecondLevel.xml", SceneConfiguration.SceneDocumentType, "CurrentLevel");
// mark that the second level has been loaded secondLevelLoaded = true;
}

There seems to be an issue with the gameTime.TotalGameTime.Milliseconds it never changes.  If I drop it down to 500 milliseconds it works fine.  I tested it out and it will switch over at 982 milliseconds, but at 983 it just stays on FirstLevel.

Am I missing something, or is this a bug?

Editor
Mar 10, 2010 at 11:03 PM
Edited Mar 10, 2010 at 11:03 PM

i think 983 is as close as you can get to 1000 milliseconds, before next update. if you add the line

Engine.Game.Window.Title = ("Time is : " + gameTime.TotalGameTime.Milliseconds.ToString());

 in your UpdateHook() function.

 

you will see that it only goes to 1000 (roughly). this is probably the reason why it doesnt work. as for it being a bug, i cannot say. pretty sure that the

code worked before though.

you can use gameTime.TotalGameTime.Seconds  and set that to 5 :)

Mar 10, 2010 at 11:33 PM

Cool thanks, doesn't really matter to me if the sample works - just trying to get a grasp on the system.  Thanks for letting me know about the .Seconds, that will be useful.

 

Coordinator
Mar 11, 2010 at 12:50 AM

man I suck...

(goes off to fix docs)

Coordinator
Mar 11, 2010 at 12:57 AM

Think I fixed it by using TotalMilliseconds instead of just Milliseconds.

I wonder if this was a recent .Net API change?

cheers :)