/// <summary> /// Callback called when world is loaded. /// </summary> public void OnLoad() { // Cache world time management fsm. GameObject sunGameObject = GameObject.Find("SUN"); Client.Assert(sunGameObject != null, "SUN game object is missing!"); // Yep it's called "Color" :> worldTimeFsm = Utils.GetPlaymakerScriptByName(sunGameObject, "Color"); Client.Assert(worldTimeFsm != null, "Now world time FSM found :("); // Register refresh world time event. if (!worldTimeFsm.Fsm.HasEvent(REFRESH_WORLD_TIME_EVENT)) { FsmEvent mpRefreshWorldTimeEvent = worldTimeFsm.Fsm.GetEvent(REFRESH_WORLD_TIME_EVENT); PlayMakerUtils.AddNewGlobalTransition(worldTimeFsm, mpRefreshWorldTimeEvent, "State 1"); } // Make sure world time is up-to-date with cache. WorldTime = worldTimeCached; gameAnimDatabase.Rebuild(); gamePickupableDatabase.Rebuild(); doorsManager.OnWorldLoad(); beerCaseManager.OnWorldLoad(); lightSwitchManager.OnWorldLoad(); LoadMailbox(); LoadVehicles(); if (GameCallbacks.onWorldLoad != null) { GameCallbacks.onWorldLoad(); } }
/// <summary> /// Callback called when world is loaded. /// </summary> public void OnLoad() { gameAnimDatabase.Rebuild(); gamePickupableDatabase.Rebuild(); doorsManager.OnWorldLoad(); LoadVehicles(); if (GameCallbacks.onWorldLoad != null) { GameCallbacks.onWorldLoad(); } }