Esempio n. 1
0
 private void Awake()
 {
     print("MasterSceneManager awake");
     DontDestroyOnLoad(this);
     Instance      = this;
     previouslevel = new Stack( );
     print("MasterSceneManager init");
     mainPause = false;
 }
 void Awake()
 {
     if (instance == null){
         instance = this;
     }else {
         Destroy(this.gameObject);
         Debug.Error("core", "Second MasterSceneManager detected. Deleting gameOject.");
         return;
     }
 }
Esempio n. 3
0
    private void Awake()
    {
        if (Instance == null)
        {
            DontDestroyOnLoad(this);
            Instance      = this;
            previouslevel = new Stack();
            bs            = GameObject.Find("BackSphere");
            if (bs != null)
            {
                DontDestroyOnLoad(bs);
                bs.SetActive(false);
            }
            hs = GameObject.Find("HelpSphere");
            if (hs != null)
            {
                DontDestroyOnLoad(hs);
                hs.SetActive(false);
            }
        }
        else
        {
            previouslevel.Clear();
            if (bs != null)
            {
                bs.SetActive(false);
            }
            if (hs != null)
            {
                hs.SetActive(false);
            }
            GameObject dd = GameObject.Find("BackSphere");
            if (dd != null)
            {
                dd.SetActive(false);
            }
            dd = GameObject.Find("HelpSphere");
            if (dd != null)
            {
                dd.SetActive(false);
            }
        }

        GameObject ts = GameObject.Find("SceneText");

        if (ts != null)
        {
            Text sceneText = ts.GetComponent <Text>();
            if (sceneText != null)
            {
                sceneText.text = scene_idx + ", " + scene_names[scene_idx];
            }
        }
    }
Esempio n. 4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
         Debug.Error("core", "Second MasterSceneManager detected. Deleting gameOject.");
         return;
     }
 }
    static void setup()
    {
        GameObject go;
        // managers
        GameObject objManager    = GameObject.Find("_ObjectManager");
        GameObject masterManager = GameObject.Find("_MasterSceneManager");
        GameObject inputManager  = GameObject.Find("_InputManager");
        GameObject audioManager  = GameObject.Find("_AudioManager");
        GameObject hudManager    = GameObject.Find("_HUDManager");
        // player
        GameObject player          = GameObject.Find("_Player");
        GameObject camera          = GameObject.Find("_Main Camera");
        GameObject abilitydockanim = GameObject.Find("AbilityDock");
        // UI
        GameObject ui = GameObject.Find("UI");

        if (objManager == null)
        {
            go = new GameObject();
            go.AddComponent <ObjectManager>();
            go.name    = "_ObjectManager";
            objManager = GameObject.Find("_ObjectManager");
            ObjectManager.AddSavedObject(go.transform);
        }

        if (masterManager == null)
        {
            go = new GameObject();
            go.AddComponent <MasterSceneManager>();
            go.name       = "_MasterSceneManager";
            masterManager = GameObject.Find("_MasterSceneManager");
            MasterSceneManager manager = masterManager.GetComponent <MasterSceneManager>();
            ObjectManager.AddSavedObject(go.transform);
            manager.InitScenesDictionary();
        }

        if (inputManager == null)
        {
            go = new GameObject();
            go.AddComponent <InputManager>();
            go.name      = "_InputManager";
            inputManager = GameObject.Find("_InputManager");
            ObjectManager.AddSavedObject(go.transform);
        }

        if (audioManager == null)
        {
            go = new GameObject();
            go.AddComponent <AudioManager>();
            go.name      = "_AudioManager";
            audioManager = GameObject.Find("_AudioManager");
            ObjectManager.AddSavedObject(go.transform);
        }

        if (ui == null)
        {
            Object prefab = AssetDatabase.LoadAssetAtPath("Assets/Prefabs/UI/UI.prefab", typeof(GameObject));
            go      = Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject;
            go.name = "UI";
            ui      = go;
        }

        if (hudManager == null)
        {
            go = new GameObject();
            GameHUD         gameHud         = go.AddComponent <GameHUD>();
            PauseMenu       pauseMenu       = go.AddComponent <PauseMenu>();
            DialogueManager dialogueManager = go.AddComponent <DialogueManager>();
            gameHud.accessManager = pauseMenu;
            pauseMenu.GHud        = gameHud;
            go.name    = "_HUDManager";
            hudManager = GameObject.Find("_HUDManager");
            ObjectManager.AddSavedObject(go.transform);
            GameHUD hud = go.GetComponent <GameHUD>();
            hud.pauseMenu = GameObject.Find("pauseMenu");
        }



        abilitydockanim = GameObject.Find("AbilityDock");
        if (abilitydockanim == null)
        {
            Object prefab = AssetDatabase.LoadAssetAtPath("Assets/Prefabs/UI/AbilityDock.prefab", typeof(GameObject));
            go                  = Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject;
            go.name             = "AbilityDock";
            abilitydockanim     = go;
            go.transform.parent = ui.transform;
        }

        if (player == null)
        {
            Object prefab = AssetDatabase.LoadAssetAtPath("Assets/Prefabs/_Player.prefab", typeof(GameObject));
            go       = Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject;
            go.name  = "_Player";
            player   = go;
            go.layer = LayerMask.NameToLayer("Player");
            Quinc quinc = go.GetComponent <Quinc>();
            quinc.abilitySelector = abilitydockanim.GetComponent <AbilityDockController>();
            ObjectManager.AddSavedObject(go.transform);
        }

        if (camera == null)
        {
            go = new GameObject();
            GameObject old = GameObject.Find("Main Camera");
            DestroyImmediate(old);
            go.AddComponent <Camera>();
            go.AddComponent <PoPCamera>();
            PoPCamera popc = go.GetComponent <PoPCamera>();
            popc.target = player.transform;
            go.name     = "_Main Camera";
            go.tag      = "MainCamera";
            camera      = GameObject.Find("_Main Camera");
            Transform cameraTarget = GameObject.Find("CameraTarget").transform;
            if (cameraTarget != null)
            {
                popc.target = cameraTarget;
            }

            //Object icon_pull = AssetDatabase.LoadAssetAtPath("Assets/Prefabs/UI/HUDIcons/abilityButtonPull.prefab", typeof(GameObject));
            //Object icon_push = AssetDatabase.LoadAssetAtPath("Assets/Prefabs/UI/HUDIcons/abilityButtonPush.prefab", typeof(GameObject));
            //Object icon_shock = AssetDatabase.LoadAssetAtPath("Assets/Prefabs/UI/HUDIcons/abilityButtonShock.prefab", typeof(GameObject));

            //hud.hudAbilityIcons.Add(Instantiate(icon_pull, Vector3.zero, Quaternion.identity) as GameObject);
            //hud.hudAbilityIcons.Add(Instantiate(icon_push, Vector3.zero, Quaternion.identity) as GameObject);
            //hud.hudAbilityIcons.Add(Instantiate(icon_shock, Vector3.zero, Quaternion.identity) as GameObject);
            ObjectManager.AddSavedObject(go.transform);
        }
    }
    private void Awake()
    {
        if (Instance == null)
        {
            DontDestroyOnLoad(this);
            Instance      = this;
            previouslevel = new Stack();
            bs            = GameObject.Find("BackButton");
            if (bs != null)
            {
                DontDestroyOnLoad(bs);
                bs.SetActive(false);
            }
            hs = GameObject.Find("HelpButton");
            if (hs != null)
            {
                DontDestroyOnLoad(hs);
                hs.SetActive(false);
            }
        }
        else
        {
            previouslevel.Clear();
            if (bs != null)
            {
                bs.SetActive(false);
            }
            if (hs != null)
            {
                hs.SetActive(false);
            }
            GameObject dd = GameObject.Find("BackButton");
            if (dd != null)
            {
                dd.SetActive(false);
            }
            dd = GameObject.Find("HelpButton");
            if (dd != null)
            {
                dd.SetActive(false);
            }
        }

        GameObject ts = GameObject.Find("SceneText");

        if (ts != null)
        {
            Text sceneText = ts.GetComponent <Text>();
            if (sceneText != null)
            {
                sceneText.text = scene_idx + ", " + scene_names[scene_idx];
            }
        }

#if UNITY_EDITOR
        if (Application.isEditor)
        {
            return;
        }
#endif

        try
        {
            AndroidJavaClass jc        = new AndroidJavaClass("com.htc.vr.BuildConfig");
            String           buildtime = jc.GetStatic <String>("VR_VERSION");
            GameObject       vrstring  = GameObject.Find("VRBuildTime");
            if (vrstring != null)
            {
                Text sceneText = vrstring.GetComponent <Text>();
                if (sceneText != null)
                {
                    sceneText.text = "VR Client AAR: " + buildtime;
                }
            }
        }
        catch (Exception e)
        {
            WaveVR_Log.Log.e(LOG_TAG, e.Message, true);
        }

        try
        {
            AndroidJavaClass jc        = new AndroidJavaClass("com.htc.vr.permission.client.BuildConfig");
            String           buildtime = jc.GetStatic <String>("AAR_BUILDTIME");
            GameObject       vrstring  = GameObject.Find("PermissionBuildTime");
            if (vrstring != null)
            {
                Text sceneText = vrstring.GetComponent <Text>();
                if (sceneText != null)
                {
                    sceneText.text = "Permission AAR: " + buildtime;
                }
            }
        }
        catch (Exception e)
        {
            WaveVR_Log.Log.e(LOG_TAG, e.Message, true);
        }

        try
        {
            AndroidJavaClass jc        = new AndroidJavaClass("com.htc.vr.ime.client.BuildConfig");
            String           buildtime = jc.GetStatic <String>("AAR_BUILDTIME");
            GameObject       vrstring  = GameObject.Find("IMEBuildTime");
            if (vrstring != null)
            {
                Text sceneText = vrstring.GetComponent <Text>();
                if (sceneText != null)
                {
                    sceneText.text = "IME AAR: " + buildtime;
                }
            }
        }
        catch (Exception e)
        {
            WaveVR_Log.Log.e(LOG_TAG, e.Message, true);
        }

        try
        {
            AndroidJavaClass jc        = new AndroidJavaClass("com.htc.vr.unity.pidemo.BuildConfig");
            String           buildtime = jc.GetStatic <String>("AAR_BUILDTIME");
            GameObject       vrstring  = GameObject.Find("PiDemoBuildTime");
            if (vrstring != null)
            {
                Text sceneText = vrstring.GetComponent <Text>();
                if (sceneText != null)
                {
                    sceneText.text = "PiDemo AAR: " + buildtime;
                }
            }
        }
        catch (Exception e)
        {
            WaveVR_Log.Log.e(LOG_TAG, e.Message, true);
        }

        try
        {
            AndroidJavaClass jc        = new AndroidJavaClass("com.htc.vr.unity.resdemo.BuildConfig");
            String           buildtime = jc.GetStatic <String>("AAR_BUILDTIME");
            GameObject       vrstring  = GameObject.Find("ResDemoBuildTime");
            if (vrstring != null)
            {
                Text sceneText = vrstring.GetComponent <Text>();
                if (sceneText != null)
                {
                    sceneText.text = "ResDemo AAR: " + buildtime;
                }
            }
        }
        catch (Exception e)
        {
            WaveVR_Log.Log.e(LOG_TAG, e.Message, true);
        }

        try
        {
            AndroidJavaClass jc        = new AndroidJavaClass("com.htc.vr.unity.resindicator.BuildConfig");
            String           buildtime = jc.GetStatic <String>("AAR_BUILDTIME");
            GameObject       vrstring  = GameObject.Find("ResIndicatorBuildTime");
            if (vrstring != null)
            {
                Text sceneText = vrstring.GetComponent <Text>();
                if (sceneText != null)
                {
                    sceneText.text = "ResIndicator AAR: " + buildtime;
                }
            }
        }
        catch (Exception e)
        {
            WaveVR_Log.Log.e(LOG_TAG, e.Message, true);
        }

        try
        {
            AndroidJavaClass jc        = new AndroidJavaClass("com.htc.vr.unity.BuildConfig");
            String           buildtime = jc.GetStatic <String>("AAR_BUILDTIME");
            GameObject       vrstring  = GameObject.Find("UnityPluginBuildTime");
            if (vrstring != null)
            {
                Text sceneText = vrstring.GetComponent <Text>();
                if (sceneText != null)
                {
                    sceneText.text = "Unity Plugin AAR: " + buildtime;
                }
            }
        }
        catch (Exception e)
        {
            WaveVR_Log.Log.e(LOG_TAG, e.Message, true);
        }
    }