private void EnableContainer(GameObject container) { if (container == null) { return; } if (FoundedTracker == null) { container.transform.SetParent(currentTracker); } else { container.transform.SetParent(FoundedTracker); Debug.Log("Enable container " + FoundedTracker); } container.transform.localPosition = Vector3.zero; container.transform.localRotation = Quaternion.identity; container.SetActive(true); currentActiveContainer = container; DianaSceneController Diana = currentActiveContainer.GetComponent <DianaSceneController>(); VideoController _Video = currentActiveContainer.GetComponent <VideoController>(); if (Diana != null) { _Diana = currentActiveContainer; } if (_Video != null) { _Video.EnableContainer(); } }
//TEMP public void OnTrackerLost() { TrackerFounded = false; cloudManager.EnableCloudReco(); DianaSceneController Diana = null; RadomirochkaController Radomirochka = null; if (currentActiveContainer != null) { Diana = currentActiveContainer.GetComponent <DianaSceneController>(); Radomirochka = currentActiveContainer.GetComponent <RadomirochkaController>(); } if (Diana != null) { Diana.Pause(); } else if (Radomirochka != null) { Radomirochka.Pause(); } else { DisableContainer(currentActiveContainer); } StandartMenu.SetActive(false); }
public void RegisterContainer(Transform container) { Debug.Log("Register " + container.name); FoundedResults.Add(lastBundleName, container.gameObject); if (FoundedTracker != null && FoundedTracker != currentTracker) { container.SetParent(FoundedTracker); container.localPosition = _containerTransform; container.localEulerAngles = _containerRotate; } else { container.SetParent(currentTracker); container.localPosition = Vector3.zero; container.localEulerAngles = Vector3.zero; } container.localPosition = _containerTransform; container.localRotation = Quaternion.Euler(_containerRotate); currentActiveContainer = container.gameObject; DianaSceneController Diana = currentActiveContainer.GetComponent <DianaSceneController>(); RadomirochkaController Radomirochka = currentActiveContainer.GetComponent <RadomirochkaController>(); VideoController _Video = currentActiveContainer.GetComponent <VideoController>(); if (Diana != null) { _Diana = currentActiveContainer; } if (Radomirochka != null) { _Radomirochka = currentActiveContainer; } if (_Video) { _Video.EnableContainer(); } }
public void LoadBundle(string _bundleName) { Debug.Log("LoadBundle " + _bundleName); TrackerFounded = true; if (FoundedResults.ContainsKey(_bundleName)) { FoundedResults[_bundleName].SetActive(true); if (FoundedTracker != null && FoundedTracker != currentTracker) { FoundedResults[_bundleName].transform.SetParent(FoundedTracker); FoundedResults[_bundleName].transform.localPosition = _containerTransform; FoundedResults[_bundleName].transform.localEulerAngles = _containerRotate; foreach (SkinnedMeshRenderer skinedMesh in FoundedResults[_bundleName].transform.GetComponentsInChildren <SkinnedMeshRenderer>()) { skinedMesh.enabled = true; } } else { FoundedResults[_bundleName].transform.SetParent(currentTracker); FoundedResults[_bundleName].transform.localPosition = Vector3.zero; FoundedResults[_bundleName].transform.localEulerAngles = Vector3.zero; } currentActiveContainer = FoundedResults[_bundleName]; DianaSceneController Diana = currentActiveContainer.GetComponent <DianaSceneController>(); RadomirochkaController Radomirochka = currentActiveContainer.GetComponent <RadomirochkaController>(); VideoController _Video = currentActiveContainer.GetComponent <VideoController>(); if (Diana != null) { Diana.Play(); _Diana = currentActiveContainer; } else { if (_Diana != null) { _Diana.SetActive(false); } } if (_Video != null) { _Video.PlayVideo(); } } else { lastBundleName = _bundleName; //currentTracker = dTrackers[_bundleUrl]; var bundleUrl = String.Join("", new string[2] { SERVER_ADDRESS, _bundleName }); Debug.Log("Begin load bundle " + bundleUrl); if (!dBundles.ContainsKey(lastBundleName)) { manager.DownloadBundle(bundleUrl, OnBundleDownloaded); } else { if (dContainers.ContainsKey(_bundleName)) { DisableContainer(currentActiveContainer); EnableContainer(dContainers[_bundleName]); Debug.Log("LoadBundle 2 " + dContainers[_bundleName]); } else { LoadScene(dBundles[lastBundleName]); Debug.Log("LoadBundle 3 " + dBundles[lastBundleName]); } } } }