Пример #1
0
        /// 破壊対象
        public void setBreakTarget(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);


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

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

            if (checkBound)
            {
                /// マーカーのセット
                destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
                destinationTrgActor.SetDeadFlag();
                if (destinationTrgActor.CheckMoveTrgId() == 1)
                {
                    TouchPostion = destinationTrgActor.BasePos;
                    destinationTrgActor.SetDeadFlag();
                }
                else if (destinationTrgActor.CheckMoveTrgId() == 2)
                {
                    TouchPostion = destinationTrgActor.BasePos;
                    destinationTrgActor.SetDeadFlag();
                }
                else if (destinationTrgActor.CheckMoveTrgId() == 3)
                {
                    TouchPostion = destinationTrgActor.BasePos;
                    destinationTrgActor.SetDeadFlag();
                }
                else
                {
                    TouchPostion = calCollLook.NextPos;
                }
            }
        }
Пример #2
0
        public void findingTower(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.CtrlTo.SetDestinationActor(useCollMgr.TrgContainer);
            /// 衝突判定
            calCollLook.SetMoveType(Data.CollTypeId.ChDestination);

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

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

                if (destinationTrgActor.CheckMoveTrgId() == 2)
                {
                    mode = 2;
                    if (bndSph != null)
                    {
                        TouchPostion = bndSph.Sphre.Pos;
                    }
                    else
                    {
                        TouchPostion = destinationTrgActor.BasePos;
                    }
                }
                else
                {
                    TouchPostion = calCollLook.NextPos;
                }
            }
        }
Пример #3
0
        /// 食べる目標決め
        public void setEatTarget( 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 );
            ctrlResMgr.CtrlHouse.SetDestinationActor( useCollMgr.TrgContainer );

            //        ctrlResMgr.CtrlTo.SetDestinationActor( useCollMgr.TrgContainer );
            //        ctrlResMgr.CtrlWall.SetDestinationActor( useCollMgr.TrgContainer );

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

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

            if( checkBound ){
            /// マーカーのセット
            destinationTrgActor = useCollMgr.TrgContainer.GetEntryObjParent(0);
            ShapeSphere bndSph  = destinationTrgActor.GetBoundingShape();

            if( destinationTrgActor.CheckMoveTrgId() == 1 ){
                if( bndSph != null ){
                    TouchPostion = bndSph.Sphre.Pos;
                }
                else{
                    TouchPostion = destinationTrgActor.BasePos;
                }
                destinationTrgActor.SetEatFlag();
            }
            else if( destinationTrgActor.CheckMoveTrgId() == 2 ){
                if( bndSph != null ){
                    TouchPostion = bndSph.Sphre.Pos;
                }
                else{
                    TouchPostion = destinationTrgActor.BasePos;
                }
                destinationTrgActor.SetEatFlag();
            }
            else if( destinationTrgActor.CheckMoveTrgId() == 3 ){
                if( bndSph != null ){
                    TouchPostion = bndSph.Sphre.Pos;
                }
                else{
                    TouchPostion = destinationTrgActor.BasePos;
                }
                destinationTrgActor.SetEatFlag();
            }else if( destinationTrgActor.CheckMoveTrgId() == 4 ){
                if( bndSph != null ){
                    TouchPostion = bndSph.Sphre.Pos;
                }
                else{
                    TouchPostion = destinationTrgActor.BasePos;
                }
                destinationTrgActor.SetEatFlag();
            }else{
                TouchPostion = calCollLook.NextPos;
            }
            }
        }
Пример #4
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;
            }
        }
Пример #5
0
        /// 壁の生成
        public void makeWall( 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.CtrlTo.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() == 2){	//始点の建物に接触
                towerNowPos = destinationTrgActor.BasePos;
                TouchPostion = destinationTrgActor.BasePos;
                if(towerPos.X != towerNowPos.X && towerPos.Z != towerNowPos.Z && !(towerPos.X == 0.0f &&  towerPos.Y == 0.0f && towerPos.Z == 0.0f)){ //最初のタッチ以外もしくは前のタワー以外との接触の場合
                    if( bndSph != null ){
                        towerNowPos.Y += bndSph.Sphre.R;
                    }
                    towerNowPos.Y += 0.1f;
                    ctrlResMgr.AddWall = true;
                    ctrlResMgr.AddWallPos1 = towerPos;
                    ctrlResMgr.AddWallPos2 = towerNowPos;
                    makeTowerFlag = false;
                    Console.WriteLine("asdf");
                }
            }else{
                Console.WriteLine("fdsa");
                towerNowPos = calCollLook.NextPos;
                TouchPostion = calCollLook.NextPos;
                towerNowPos.Y += 0.1f;
                if(towerPos.X == 0.0f &&  towerPos.Y == 0.0f && towerPos.Z == 0.0f){
                    towerPos = towerNowPos;
                    effectPos = towerNowPos;
                    //ctrlResMgr.CtrlTo.EntryAddTower( 1, 0.0f, towerNowPos, (int)StaticDataList.getRandom(0,5));
                }
                double dis2 = Common.VectorUtil.Distance( towerPos , towerNowPos );
                if(dis2 > newTowerDis){
                    ctrlResMgr.AddWall = true;
                    ctrlResMgr.AddWallPos1 = towerPos;
                    ctrlResMgr.AddWallPos2 = towerNowPos;

                    ctrlResMgr.AddTower = true;
                    ctrlResMgr.AddTowerPos = towerNowPos;

                    TowerAreaNorth = FMath.Max(TowerAreaNorth , towerNowPos.X);
                    TowerAreaSouth = FMath.Min(TowerAreaSouth , towerNowPos.X);
                    TowerAreaEast = FMath.Max(TowerAreaEast , towerNowPos.Z);
                    TowerAreaWest = FMath.Min(TowerAreaWest , towerNowPos.Z);
                    //AppSound.GetInstance().PlaySeCamDis( AppSound.SeId.MakeMo, towerNowPos );

                    towerPos = towerNowPos;
                    //sumPos += towerPos;
                    //sumcount++;
                }
                dis2 = Common.VectorUtil.Distance( effectPos , towerNowPos );
                if(dis2 > newEffectDis){
                    ctrlResMgr.AddEffectFromEnemy = true;
                    ctrlResMgr.AddEnemyEffectPos = towerNowPos;
                    effectPos = towerNowPos;
                }
            }
            }
        }
Пример #6
0
        /// 壁の生成
        public void makeWall(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.CtrlTo.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() == 2)          //始点の建物に接触
                {
                    towerNowPos  = destinationTrgActor.BasePos;
                    TouchPostion = destinationTrgActor.BasePos;
                    if (towerPos.X != towerNowPos.X && towerPos.Z != towerNowPos.Z && !(towerPos.X == 0.0f && towerPos.Y == 0.0f && towerPos.Z == 0.0f))              //最初のタッチ以外もしくは前のタワー以外との接触の場合
                    {
                        if (bndSph != null)
                        {
                            towerNowPos.Y += bndSph.Sphre.R;
                        }
                        towerNowPos.Y         += 0.1f;
                        ctrlResMgr.AddWall     = true;
                        ctrlResMgr.AddWallPos1 = towerPos;
                        ctrlResMgr.AddWallPos2 = towerNowPos;
                        makeTowerFlag          = false;
                        Console.WriteLine("asdf");
                    }
                }
                else
                {
                    Console.WriteLine("fdsa");
                    towerNowPos    = calCollLook.NextPos;
                    TouchPostion   = calCollLook.NextPos;
                    towerNowPos.Y += 0.1f;
                    if (towerPos.X == 0.0f && towerPos.Y == 0.0f && towerPos.Z == 0.0f)
                    {
                        towerPos  = towerNowPos;
                        effectPos = towerNowPos;
                        //ctrlResMgr.CtrlTo.EntryAddTower( 1, 0.0f, towerNowPos, (int)StaticDataList.getRandom(0,5));
                    }
                    double dis2 = Common.VectorUtil.Distance(towerPos, towerNowPos);
                    if (dis2 > newTowerDis)
                    {
                        ctrlResMgr.AddWall     = true;
                        ctrlResMgr.AddWallPos1 = towerPos;
                        ctrlResMgr.AddWallPos2 = towerNowPos;

                        ctrlResMgr.AddTower    = true;
                        ctrlResMgr.AddTowerPos = towerNowPos;

                        TowerAreaNorth = FMath.Max(TowerAreaNorth, towerNowPos.X);
                        TowerAreaSouth = FMath.Min(TowerAreaSouth, towerNowPos.X);
                        TowerAreaEast  = FMath.Max(TowerAreaEast, towerNowPos.Z);
                        TowerAreaWest  = FMath.Min(TowerAreaWest, towerNowPos.Z);
                        //AppSound.GetInstance().PlaySeCamDis( AppSound.SeId.MakeMo, towerNowPos );

                        towerPos = towerNowPos;
                        //sumPos += towerPos;
                        //sumcount++;
                    }
                    dis2 = Common.VectorUtil.Distance(effectPos, towerNowPos);
                    if (dis2 > newEffectDis)
                    {
                        ctrlResMgr.AddEffectFromEnemy = true;
                        ctrlResMgr.AddEnemyEffectPos  = towerNowPos;
                        effectPos = towerNowPos;
                    }
                }
            }
        }
Пример #7
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;
            }
        }