void MarkAllPlayce(WsPlaceMarkList wpmlist, bool ContainMyself = true) { VRPlayceDot[] vp = GetComponentsInChildren <VRPlayceDot>(); foreach (var item in vp) { item.isPlaced = false; item.PlacedWSID = ""; } foreach (var item in wpmlist.marks) { if (item.id != mStaticThings.I.mAvatarID || ContainMyself) { if (mStaticThings.AllActiveAvatarList.Contains(item.id) && item.dname != null) { Transform target = Playces.Find(item.dname); if (target != null) { VRPlayceDot tvp = target.GetComponent <VRPlayceDot>(); if (tvp != null) { tvp.isPlaced = true; tvp.PlacedWSID = item.id; } } } } } }
void PlayceToNew(WsPlaceMark wpm) { if (mStaticThings.I == null) { return; } if (wpm.dname == "") { if (WsPlaceMarkDic.ContainsKey(wpm.id)) { if (WsPlaceMarkDic[wpm.id] != wpm.dname) { RemoveSingleDotPlayced(WsPlaceMarkDic[wpm.id]); WsPlaceMarkDic[wpm.id] = wpm.dname; } } else { WsPlaceMarkDic.Add(wpm.id, wpm.dname); } return; } Transform target = Playces.Find(wpm.dname); if (target == null) { int sort = mStaticThings.I.GetSortNumber(mStaticThings.I.mAvatarID); int maxnum = StartGroup.GetComponent <VRPlayceGroup>()._VRPlayceDots.Count - 1; int findnum = Mathf.Clamp(sort, 0, maxnum); target = StartGroup.GetComponent <VRPlayceGroup>()._VRPlayceDots[findnum].transform; } if (WsPlaceMarkDic.ContainsKey(wpm.id)) { if (WsPlaceMarkDic[wpm.id] != target.name) { RemoveSingleDotPlayced(WsPlaceMarkDic[wpm.id]); WsPlaceMarkDic[wpm.id] = target.name; } } else { WsPlaceMarkDic.Add(wpm.id, target.name); } VRPlayceDot vp = target.GetComponent <VRPlayceDot>(); if (vp == null) { return; } vp.isPlaced = true; vp.PlacedWSID = wpm.id; //Debug.LogWarning(wpm.id + " " + mStaticThings.I.mWsID); if (wpm.id == mStaticThings.I.mAvatarID) { if (mStaticThings.I.MainVRROOT == null) { return; } bool ccenabled = false; if (mStaticThings.I.MainVRROOT.GetComponent <CharacterController>()) { if (mStaticThings.I.MainVRROOT.GetComponent <CharacterController>().enabled) { ccenabled = true; mStaticThings.I.MainVRROOT.GetComponent <CharacterController>().enabled = false; } } PlayceDotKind dotkind = vp.dotkind; mStaticThings.I.MainVRROOT.position = target.position; if (dotkind == PlayceDotKind.direction) { mStaticThings.I.MainVRROOT.rotation = target.rotation; } else if (dotkind == PlayceDotKind.recenter) { mStaticThings.I.MainVRROOT.rotation = target.rotation; MessageDispatcher.SendMessage(CommonVREventType.VRrecenter.ToString()); } mStaticThings.I.MainVRROOT.localScale = target.lossyScale; foreach (var item in mStaticThings.I.VRCameras) { item.nearClipPlane = target.lossyScale.x * 0.1f; item.farClipPlane = target.lossyScale.x * 1000f; } if (ccenabled) { mStaticThings.I.MainVRROOT.GetComponent <CharacterController>().enabled = true; } MessageDispatcher.SendMessage(this, VrDispMessageType.SelfPlaceTo.ToString(), wpm.dname, 0); } }