コード例 #1
0
        /// <summary>
        /// ペットを呼ぶ
        /// </summary>
        /// <param name="petRoot">ペットをぶらさげるRoot</param>
        /// <param name="info">ペットを呼んだ際の通知用info</param>
        public PetPresenter ActivatePet(Transform petRoot, Vector3 position, Vector3 forward)
        {
            var pet = PetPresenter.Create(petRoot);

            pet.SetPosition(position);
            pet.transform.LookAt(forward);

            _model.SetMode(UIMode.Breed);
            return(pet);
        }
コード例 #2
0
        private void SetEvent()
        {
            _breederUIView.AnchorSystemUIView.AnchorSettingButton.onClickedCallback += () =>
            {
                if (!CloudAnchorManager.Instance.AnchorModel.IsTrackable.Value)
                {
                    return;
                }

                if (CloudAnchorManager.Instance.AnchorModel.CloudMode == ApplicationMode.Hosting)
                {
                    CloudAnchorManager.Instance.HostLastPlacedAnchor();
                }
                else if (CloudAnchorManager.Instance.AnchorModel.CloudMode == ApplicationMode.Resolving)
                {
                    CloudAnchorManager.Instance.ResolveAnchorFromId(RoomManager.Instance.AnchorId);
                }

                _model.SetMode(UIMode.Activate);
            };

            _breederUIView.PetSystemUIView.PetActivationButton.onClickedCallback += () =>
            {
                if (!CloudAnchorManager.Instance.AnchorModel.IsTrackable.Value)
                {
                    return;
                }

                var pet = _activatorUseCase.ActivatePet(_petRoot, CloudAnchorManager.Instance.CurrentAnchor.position, Vector3.forward);
                _petPresenter = pet;

                Vector3 petWorldPosition =
                    AnchorPositionUtility.GetWorldPointFromAnchorPoint(CloudAnchorManager.Instance.CurrentAnchor,
                                                                       pet.position);
                Vector3 petWorldForward =
                    AnchorPositionUtility.GetWorldPointFromAnchorPoint(CloudAnchorManager.Instance.CurrentAnchor,
                                                                       pet.transform.forward);
                CloudTransformInfo petWorldTransformInfo = new CloudTransformInfo(petWorldPosition, petWorldForward);

                _photonView.RPC(RPCDefine.BreederRPC.GetRPCMethod(RPCDefine.BreederRPC.RPCEnum.PetActivate), PhotonTargets.Others, petWorldTransformInfo);
            };
        }
コード例 #3
0
        public override void Initialize()
        {
            _model = new BreederModel();
            _breederUIView.Initialize();

            _activatorUseCase = new BreederActivatorUseCase(_model);
            _arUseCase        = new BreederARUseCase(_planeDetectionGesture);

            if (PhotonNetwork.isNonMasterClientInRoom)
            {
                CloudAnchorManager.Instance.SetResolverMode();
            }
            else
            {
                CloudAnchorManager.Instance.SetHostMode();
            }

            BindCommon();
            BindAutomaticTrackingUseCase();
            SetEvent();

            _model.SetMode(UIMode.Anchor);
        }