/// <summary> /// アンカーの可視化に利用するGameobjectを生成します。 /// </summary> /// <param name="isDestination">中継点か目的地かを判定するフラグ</param> public void CreateAnchorObject(bool isDestination) { try { Menu.ChangeStatus(RouteGuideMenu.MODE_CREATE_ANCHOR); this.isDestination = isDestination; if (currentAnchorObject == null) { currentAnchorObject = settingPointAnchor.gameObject; } var dest = AnchorGenerateFactory.GenerateSettingsPointAnchor(isDestination ? SettingPointAnchor.AnchorMode.Destination : SettingPointAnchor.AnchorMode.Point); currentLinkLine = LinkLineGenerateFactory.CreateLinkLineObject(currentAnchorObject, dest.gameObject, AnchorCollection.transform); currentAnchorObject = dest.gameObject; currentAnchorObject.transform.parent = AnchorCollection.transform; currentAnchorObject.transform.position = Camera.main.transform.position + Camera.main.transform.forward * 1f; } catch (Exception e) { Debug.Log(e); throw; } }
/// <summary> /// Spatial Anchorの設置完了時に実行する処理 /// Spatial Anchorの設置がすべて完了した場合に実行されます。 /// </summary> public void OnLocatedAnchorComplete() { try { foreach (var current in RouteInfo.LocatedAnchors.Keys) { Debug.Log( $"Current:{current} IsLinkLineCreated:{RouteInfo.LocatedAnchors[current].IsLinkLineCreated}"); var appProperties = RouteInfo.LocatedAnchors[current].AppProperties; if (!RouteInfo.LocatedAnchors[current].IsLinkLineCreated) { RouteInfo.LocatedAnchors[current].IsLinkLineCreated = true; var dest = RouteInfo.LocatedAnchors[current].AnchorObject; if (appProperties.ContainsKey(RouteGuideInformation.PREV_ANCHOR_ID)) { var key = appProperties[RouteGuideInformation.PREV_ANCHOR_ID]; if (RouteInfo.LocatedAnchors.TryGetValue(key, out var anchorInfo)) { var pointObj = anchorInfo.AnchorObject.GetComponent <DestinationPointAnchor>(); pointObj?.DisabledEffects(); var basePointObj = anchorInfo.AnchorObject.GetComponent <SettingPointAnchor>(); basePointObj?.DisabledEffects(); Debug.Log($"LinkLine:{anchorInfo.AnchorObject.name} to {dest.name}"); LinkLineGenerateFactory.CreateLinkLineObject(anchorInfo.AnchorObject, dest, RouteInfo.RootLinkLineObjects.transform); } } } } } catch (Exception e) { Debug.Log(e); throw; } }