コード例 #1
0
        private IEnumerator loadSceneAsync(string sceneName, int id)
        {
            //load scene a
            AsyncOperation async = Application.LoadLevelAdditiveAsync(sceneName);

            yield return(async);

            //asdfasdf

            ToolbeltManager[] tbms = FindObjectsOfType(typeof(ToolbeltManager)) as ToolbeltManager[];
            ToolbeltManager   tm   = null;

            foreach (ToolbeltManager tbm in tbms)
            {
                if (!tbm.assignedUniqueID && tbm.gameObject.name == "__" + sceneName)
                {
                    tm = tbm;
                    tm.assignUniqueID(id);
                    break;
                }
            }

            if (tm == null)
            {
                throw new MissingReferenceException("Component incorrectly named or does not include a Scene script: " + sceneName);
            }
            else
            {
                tm.JustFinishedAsyncLoad(this);
                this.DoneLoadOtherScene(tm);
            }
        }
コード例 #2
0
 //called when another object finished loading by this tm
 protected override void DoneLoadOtherScene(ToolbeltManager tm)
 {
     if (tm.getUniqueID() == this.scene2id) {
         Debug.Log ("scene2 loaded!");
         tm.ActivateSceneParent();
     }
     //you can identify the other tm via its uniqueID.
 }
コード例 #3
0
        void SwitchEyes()
        {
            ToolbeltManager tm = ToolbeltManager.FirstInstance;

            // Remove previous eye layer from culling mask
            this.camera.cullingMask = this.camera.cullingMask & ~(1 << tm.GetStereoLayer(this.curStereo));

            this.curStereo = (this.curStereo == StereoMode.LEFT) ? StereoMode.RIGHT : StereoMode.LEFT;

            this.camera.cullingMask = this.camera.cullingMask | (1 << tm.GetStereoLayer(this.curStereo));
            //Debug.Log(Time.frameCount.ToString() + " " + this.camera.cullingMask.ToString());
        }
コード例 #4
0
        void Awake()
        {
            this.PreAwakeSubclass();
            // The first ToolbeltManager to start up will be stored
            if (instance == null)
            {
                instance         = this;
                this.mediaLoader = new icMediaLoader(this.concurrentMediaLoads, useBink);
                this.soundLoader = new icMediaLoader(this.concurrentMediaLoads, false);
                if (imageCacheMBs > 0)
                {
                    imageCacher = new icImageCacher(imageCacheMBs, imageCacheGraceTime);
                }

                this.assignUniqueID(ToolbeltManager.GenerateUniqueID());
                this.ActivateSceneParent();
            }
            this.AwakeSubclass();
            // TODO: don't initialise singletons if being loaded by another scene
            // Scene loading code should look for ToolbeltManager and set
            // parameters appropriately
        }
コード例 #5
0
 //called when another object finished loading by this tm
 protected virtual void DoneLoadOtherScene(ToolbeltManager tm)
 {
     //you can identify the other tm via its uniqueID.
 }
コード例 #6
0
 protected void JustFinishedAsyncLoad(ToolbeltManager tm)
 {
     //called when this object was loaded async by another tbm
     this.masterManager    = tm;
     this.transform.parent = tm.transform;
 }
コード例 #7
0
        void Awake()
        {
            this.PreAwakeSubclass();
            // The first ToolbeltManager to start up will be stored
            if (instance == null) {
                instance = this;
                this.mediaLoader = new icMediaLoader(this.concurrentMediaLoads, useBink);
                this.soundLoader = new icMediaLoader(this.concurrentMediaLoads, false);
                if (imageCacheMBs > 0)
                    imageCacher = new icImageCacher(imageCacheMBs, imageCacheGraceTime);

                this.assignUniqueID(ToolbeltManager.GenerateUniqueID());
                this.ActivateSceneParent();

            }
            this.AwakeSubclass();
            // TODO: don't initialise singletons if being loaded by another scene
            // Scene loading code should look for ToolbeltManager and set
            // parameters appropriately
        }
コード例 #8
0
 protected void JustFinishedAsyncLoad(ToolbeltManager tm)
 {
     //called when this object was loaded async by another tbm
     this.masterManager = tm;
     this.transform.parent = tm.transform;
 }
コード例 #9
0
 //called when another object finished loading by this tm
 protected virtual void DoneLoadOtherScene(ToolbeltManager tm)
 {
     //you can identify the other tm via its uniqueID.
 }