public void LoadTarget() { int design = PlayerPrefs.GetInt("design", 0); var imageTargetName_FileDic = pathManager.GetDirectoryName_FileDic(); imageTargets.Clear(); foreach (var obj in imageTargetName_FileDic.Where(obj => !imageTargetDic.ContainsKey(obj.Key))) { Debug.Log("!!!!!!!!!imageTargetName_FileDic = " + obj.Key); GameObject imageTarget = new GameObject(obj.Key); imageTargets.Add(imageTarget); var behaviour = imageTarget.AddComponent <ImageTargetController>(); behaviour.TargetName = obj.Key; behaviour.TargetPath = obj.Value.Replace(@"\", "/"); behaviour.Type = PathType.Absolute; behaviour.ImageTracker = Tracker; imageTargetDic.Add(obj.Key, behaviour); var cube = Instantiate(Resources.Load("HelloAR_TargetOnFly/Prefabs/Cube")) as GameObject; cube.transform.parent = imageTarget.transform; cube.transform.GetChild(design == 0 ? 1 : 0).gameObject.SetActive(false); //cube.AddComponent<WallCube>(); ImageOnFly canvas = GameObject.Find("Canvas").GetComponent <ImageOnFly>(); float mul = 0.5f; cube.transform.localPosition = new Vector3(canvas.valx * mul, canvas.valy * mul, cube.transform.localPosition.z); Debug.Log(canvas.valx + ", " + canvas.valy + " !!!!!!!!!cube Name~~~ " + cube.name); } }
void Update() { var imageTargetName_FileDic = pathManager.GetDirectoryName_FileDic(); foreach (var obj in imageTargetName_FileDic.Where(obj => !imageTargetDic.ContainsKey(obj.Key))) { GameObject imageTarget = new GameObject(obj.Key); imageTarget.AddComponent <PersistenceMarker>(); var behaviour = imageTarget.AddComponent <DynamicImageTagetBehaviour>(); behaviour.Name = obj.Key; behaviour.Path = obj.Value.Replace(@"\", "/"); behaviour.Storage = StorageType.Absolute; behaviour.Bind(ARBuilder.Instance.ImageTrackerBehaviours[0]); imageTargetDic.Add(obj.Key, behaviour); } }
public void LoadTarget() { var imageTargetName_FileDic = pathManager.GetDirectoryName_FileDic(); foreach (var obj in imageTargetName_FileDic.Where(obj => !imageTargetDic.ContainsKey(obj.Key))) { GameObject imageTarget = new GameObject(obj.Key); var behaviour = imageTarget.AddComponent <ImageTargetController>(); behaviour.TargetName = obj.Key; behaviour.TargetPath = obj.Value.Replace(@"\", "/"); behaviour.Type = PathType.Absolute; behaviour.ImageTracker = Tracker; imageTargetDic.Add(obj.Key, behaviour); var cube = Instantiate(Resources.Load("HelloAR_TargetOnFly/Prefabs/Cube")) as GameObject; cube.transform.parent = imageTarget.transform; } }
public void LoadTarget() { var imageTargetName_FileDic = pathManager.GetDirectoryName_FileDic(); foreach (var obj in imageTargetName_FileDic.Where(obj => !imageTargetDic.ContainsKey(obj.Key))) { GameObject imageTarget = new GameObject(obj.Key); imageTarget.transform.parent = imgParent.transform; var behaviour = imageTarget.AddComponent <ImageTargetController>(); behaviour.TargetName = obj.Key; behaviour.TargetPath = obj.Value.Replace(@"\", "/"); behaviour.Type = PathType.Absolute; behaviour.ImageTracker = Tracker; imageTargetDic.Add(obj.Key, behaviour); GameObject slide = window; slide.GetComponent <parentSc>().parent = imageTarget.transform; behaviour.window = slide; setText.tM = slide.GetComponent <TMPro.TextMeshPro>(); LoadAndDisplayImages.quad = slide.transform.Find("monitor").gameObject; slide.transform.parent = imageTarget.transform; } }