예제 #1
0
        /// <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();
            }
        }
예제 #2
0
		/// <summary>
		/// Callback called when world is loaded.
		/// </summary>
		public void OnLoad() {
			// Register all game objects.

			GameObject[] gos = Resources.FindObjectsOfTypeAll<GameObject>();

			foreach (GameObject go in gos) {
				if (!worldHashGenerated) {
					Transform transform = go.transform;
					while (transform != null) {
						worldHash ^= Utils.StringJenkinsHash(transform.name);
						transform = transform.parent;
					}
				}

				HandleNewObject(go);
			}

			Logger.Log("World hash: " + worldHash);
			worldHashGenerated = true;

			// Check mandatory objects.

			Client.Assert(worldTimeFsm != null, "No world time FSM found :(");
			Client.Assert(lastnameFSM != null, "Mailbox FSM couldn't be found!");
			Client.Assert(lastnameTextMesh != null, "Mailbox TextMesh couldn't be found!");

			// Notify different parts of the mod about the world load.

			if (GameCallbacks.onWorldLoad != null) {
				GameCallbacks.onWorldLoad();
			}
		}
예제 #3
0
파일: GameWorld.cs 프로젝트: kuppa213/MSCMP
        /// <summary>
        /// Callback called when world is loaded.
        /// </summary>
        public void OnLoad()
        {
            gameAnimDatabase.Rebuild();
            gamePickupableDatabase.Rebuild();

            doorsManager.OnWorldLoad();
            LoadVehicles();

            if (GameCallbacks.onWorldLoad != null)
            {
                GameCallbacks.onWorldLoad();
            }
        }