示例#1
0
        private void BuildSpace(Scene scene, LoadSceneMode mode)
        {
            Debug.Log(this.name + " (" + this.id + ") [Building Space]");

            SceneManager.sceneLoaded   -= BuildSpace;
            SceneManager.sceneUnloaded += UnloadSpace;
            if (Graph != null)
            {
                Graph.RenderGraph();
            }

            if (!GameObject.FindObjectOfType <LightWidget>())
            {
                UserSession.Instance.GetInstance("Default Light Rig");
            }

            if (!GameObject.FindObjectOfType <AvatarWidget>())
            {
                var ago = UserSession.Instance.GetInstance("Avatar");
                ago.name = ago.name.Replace("(Clone)", "");
                var avatar = ago.GetComponent <AvatarWidget>();
                avatar.Initialize();
            }

            if (!GameObject.FindObjectOfType <LocationWidget>())
            {
                var location = LocationWidget.Create("Start Location", Vector3.zero);
                location.defaultLocation = true;
                location.Initialize();
            }

            ProcessEnd(Process.Loading);
        }
        public void Teleport(string locationID)
        {
            FindObjectsOfType <LocationWidget>().ToList().ForEach(l => l.Deactivate());

            LocationWidget location = FindObjectsOfType <LocationWidget>().FirstOrDefault(l => l.InstanceID == locationID);

            if (location)
            {
                location.Activate();
            }
            else
            {
                Debug.Log(this.name + " [Teleport Failed] Location " + locationID + " not found.");
            }
        }