コード例 #1
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            hasChangedPrefabs = false;

            InitializeGameObjects();

            if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame)
            {
#if DEBUG
                // Editor
                if (mode == LoadMode.LoadAsset || mode == LoadMode.NewAsset)
                {
                    if (enableEditor)
                    {
                        UIView view = UIView.GetAView();
                        uiGameObject = new GameObject();
                        uiGameObject.transform.SetParent(view.transform);
                        uiGameObject.AddComponent <Editor.UIMainPanel>().SetEditorWarning(showEditorWarning);
                        uiGameObject.AddComponent <Editor.PrefabWatcher>();
                    }
                }
#endif
                return;
            }

            UpdateVehicleEffects();

            reloadBehaviour = gameObject.AddComponent <ReloadEffectsBehaviour>();
            reloadBehaviour.SetMod(this);
        }
コード例 #2
0
 private void InitializeGameObjects()
 {
     Logging.Log("Initializing Game Objects");
     if (gameObject == null)
     {
         Logging.Log("Game Objects not created, creating new Game Objects");
         gameObject = new GameObject("Vehicle Effects Mod");
         UnityEngine.Object.DontDestroyOnLoad(gameObject);
         CreateCustomEffects();
         reloadBehaviour = gameObject.AddComponent <ReloadEffectsBehaviour>();
         reloadBehaviour.SetMod(this);
         customSounds.InitializeGameObjects(gameObject.transform);
     }
     Logging.Log("Done initializing Game Objects");
 }