예제 #1
0
/// private メソッド
///---------------------------------------------------------------------------

        /// 目的地セット
        public void setDestination(int scrPosX, int scrPosY)
        {
            GameActorCollManager useCollMgr = actorDestination.GetMoveCollManager();

            Vector3 posStart = new Vector3(0, 0, 0);
            Vector3 posEnd   = new Vector3(0, 0, 0);

            /// チェックする開始座標と終了座標のセット
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 0.0f, ref posStart);
            ctrlResMgr.GraphDev.GetScreenToWorldPos(scrPosX, scrPosY, 1.0f, ref posEnd);


            DemoGame.GeometryLine moveMoveLine = new DemoGame.GeometryLine(posStart, posEnd);

            /// 衝突対象の登録
            useCollMgr.TrgContainer.Clear();

            ctrlResMgr.CtrlHobit.SetDestinationActor(useCollMgr.TrgContainer);
            ctrlResMgr.CtrlTo.SetDestinationActor(useCollMgr.TrgContainer);
            ctrlResMgr.CtrlWall.SetDestinationActor(useCollMgr.TrgContainer);
            useCollMgr.TrgContainer.Add(actorStg, actorStg.GetUseObj(0));


            /// 衝突判定
            calCollLook.SetMoveType(Data.CollTypeId.ChDestination);

            bool checkBound = calCollLook.Check(useCollMgr, moveMoveLine);

            if (checkBound)
            {
                /// マーカーのセット
                actorDestination.Start();

                Matrix4 mtx = Matrix4.RotationY(0);

                destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
                ShapeSphere bndSph = destinationTrgActor.GetBoundingShape();

                if (destinationTrgActor.CheckMoveTrgId() == 1)
                {
                    if (bndSph != null)
                    {
                        destinationPos = bndSph.Sphre.Pos;
                    }
                    else
                    {
                        destinationPos = destinationTrgActor.BasePos;
                    }
                    actorDestination.SetType(0);
                }
                else if (destinationTrgActor.CheckMoveTrgId() == 2)
                {
                    destinationPos = destinationTrgActor.BasePos;
                    if (bndSph != null)
                    {
                        destinationPos.Y += bndSph.Sphre.R;
                    }
                    actorDestination.SetType(0);
                }
                else
                {
                    destinationPos    = calCollLook.NextPos;
                    destinationPos.Y += 0.02f;
                    actorDestination.SetType(1);
                }

                Common.MatrixUtil.SetTranslate(ref mtx, destinationPos);
                actorDestination.SetPlace(mtx);

                actorDestination.Enable = true;
            }
            else
            {
                actorDestination.Enable = false;
            }
        }