Beispiel #1
0
        /// フレーム処理:移動
        private void frameMove2d()
        {
            if (useCollMgr != null)
            {
                calCollMove.SetMoveType(Data.CollTypeId.littleMove);

                useCollMgr.MoveShape.SetMult(baseMtx);
                Vector3 movePos = StaticDataList.getVectorZero();
                calCollMove.GetMovePos(useCollMgr, calCollGrav.TreadVec, (moveVec * movePow), ref movePos);
                basePos = movePos;
                for (int checkCnt = 0; checkCnt < 4; checkCnt++)
                {
                    if (calCollMove.Check(useCollMgr, movePos) == true)
                    {
                        movePos = calCollMove.NextPos;
                    }
                    else
                    {
                        basePos = calCollMove.NextPos;
                        break;
                    }
                }
            }
            else
            {
                basePos = (moveVec * movePow) + basePos;
            }

            Common.MatrixUtil.SetTranslate(ref baseMtx, basePos);

            playId     &= ~PlayId.Move2d;
            isUpdateMtx = true;
        }
Beispiel #2
0
        public void FrameGravity2d(ref bool flag)
        {
            if (useCollMgr != null)
            {
                do
                {
                    useCollMgr.MoveShape.SetMult(baseMtx);
                    Vector3 movePos = StaticDataList.getVectorZero();
                    calCollGrav.GetMovePos(useCollMgr, ref movePos);

                    if (calCollGrav.Check(useCollMgr, movePos) == true)
                    {
                        basePos = calCollGrav.NextPos;
                        break;
                        /// OBJに接地
                    }
                    if (calCollGrav.TouchPos0() == true)
                    {
                        basePos = calCollGrav.NextPos;
                        break;
                    }
                    basePos = calCollGrav.NextPos;
                    Common.MatrixUtil.SetTranslate(ref baseMtx, basePos);
                }while(flag == true);
                flag = false;
            }
            Common.MatrixUtil.SetTranslate(ref baseMtx, basePos);
            playId     &= ~PlayId.Move2d;
            isUpdateMtx = true;
        }
Beispiel #3
0
        /// 初期化
        public override bool DoInit()
        {
            shapeMove = null;

            shapeMove = new ShapeSphere();
            shapeMove.Init(1);
            shapeMove.Set(0, StaticDataList.getVectorZero(), 0.3f);

            shapeColl = new ShapeCapsule();
            shapeColl.Init(1);
            shapeColl.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TitanSize);

            shapeCollforDis = new ShapeCapsule();
            shapeCollforDis.Init(1);
            shapeCollforDis.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TouchSize);
            scale = (int)Data.SetupValue.CharScale / 100.0f;

            moveAngle   = false;
            preDeadFlag = false;



//			useMdlHdl = new Common.ModelHandle();
//        useMdlHdl.Init();
            return(true);
        }
Beispiel #4
0
        /// アクタの所属マップ生成
        private void updateGridEntryList()
        {
            Vector3 pos = StaticDataList.getVectorZero();

            for (int i = 0; i < gridMax; i++)
            {
                gridActorIdxList[i].Clear();
            }

            for (int x = 0; x < gridNum; x++)
            {
                pos.X = -300.0f + 2.5f + x * 5.0f;

                for (int y = 0; y < gridNum; y++)
                {
                    pos.Z = -300.0f + 2.5f + y * 5.0f;

                    for (int i = 0; i < actorFixList.Count; i++)
                    {
                        ShapeSphere bndSph = actorFixList[i].GetBoundingShape();
                        if (Common.VectorUtil.DistanceXZ(pos, GetPos(i)) < gridAreaDis + bndSph.Sphre.R)
                        {
                            gridActorIdxList[x + y * gridNum].Add(i);
                        }
                    }
                }
            }
        }
Beispiel #5
0
        /// 初期化
        public override bool DoInit()
        {
            shapeMove = null;

            shapeMove = new ShapeSphere();
            shapeMove.Init(1);
            shapeMove.Set(0, StaticDataList.getVectorZero(), 0.4f);

            shapeColl = new ShapeCapsule();
            shapeColl.Init(1);
            shapeColl.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TitanSize);

            shapeCollforDis = new ShapeCapsule();
            shapeCollforDis.Init(1);
            shapeCollforDis.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TouchSize);

            appearCount = 30;
            glowCounter = 0;
            scale       = (int)Data.SetupValue.WallScale / 100.0f;

            farFlag = false;

            distance = Common.VectorUtil.DistanceXZ(pos1, pos2);
            angle    = FMath.Atan((pos1.X - pos2.X) / (pos1.Z - pos2.Z)) + FMath.PI / 2;

            return(true);
        }
        /// シーンの初期化
        public bool Init(DemoGame.SceneManager sceneMgr)
        {
            useSceneMgr = sceneMgr;

            calCollGrav = new ActorUnitCollGravity();
            calCollGrav.Init();

            moveCollMgr = new GameActorCollManager();
            moveCollMgr.Init();

            shapeMove = new ShapeSphere();
            shapeMove.Init(1);
            shapeMove.Set(0, StaticDataList.getVectorZero(), 0.001f);

            renderSph = new DemoGame.RenderGeometry();
            renderSph.MakeSphere();
///        trgObj        = null;

            /// 移動する自身のOBJを登録
            moveCollMgr.SetMoveShape(shapeMove);


            trgObjMoveSpd = 1.0f;
            setPlaceTypeParam(trgObjType);

            nowTaskId = debugMenuTaskId.SelectObj;
            changeTask(debugMenuTaskId.SelectObj);
            return(true);
        }
        /// カプセルとカプセルとの衝突
        public bool Check(DemoGame.GeometryCapsule moveCap, ShapeCapsule trgCap)
        {
            /// 同じ座標にいる場合はすり抜ける
            if (moveCap.StartPos == trgCap.Capsule.StartPos)
            {
                //           return false;
            }

            /// 対象と反対向きへ移動する際にはすり抜ける
            float rot = Common.VectorUtil.GetPointRotY(moveCap.Line.Vec, moveCap.StartPos, trgCap.Capsule.StartPos);

            if (rot <= -50.0f || rot >= 50.0f)
            {
//            return false;
            }

            Vector3 collPos = StaticDataList.getVectorZero();

            calMovePos = moveCap.EndPos;
            if (DemoGame.CommonCollision.CheckCapsuleAndCapsule(moveCap, trgCap.Capsule, ref collPos) == true)
            {
                calMovePos = collPos;
                return(true);
            }

            return(false);
        }
Beispiel #8
0
/// public メソッド
///---------------------------------------------------------------------------

        /// 初期化
        public bool Init()
        {
            actorStg = new ActorStgNormal();
            actorStg.Init();

            actorDestination = new ActorDestinationMark();
            actorDestination.Init();

            calCollLook = new ActorUnitCollLook();
            calCollLook.Init();

            EventCntr = new GameActorEventContainer();
            EventCntr.Init();

            towerPos.Xyz      = StaticDataList.getVectorZero();
            effectPos.Xyz     = StaticDataList.getVectorZero();
            mode              = 0;
            TouchCount        = 0;
            MonumentSetFlag   = false;
            makeEnemyMonument = 0;

            TowerAreaNorth = -114.4f;
            TowerAreaSouth = -120.4f;
            TowerAreaEast  = 109.0f;
            TowerAreaWest  = 103.0f;

            return(true);
        }
Beispiel #9
0
/// public メソッド
///---------------------------------------------------------------------------

/*
 *  /// ボーンの姿勢を取得
 *  public Matrix4 GetBoneMatrix( int boneId )
 *  {
 * //        return useMdlHdl.GetBoneMatrix( boneId );
 *  }
 */
        /// モデルのセット
        public void SetMdlHandle(Data.ChTypeId chTypeId)
        {
            shapeColl.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 20.0f);
            shapeCollforDis.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 1.0f);

            /*        switch( chTypeId ){
             * case Data.ChTypeId.MonumentA: shapeColl.Set( 0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 1.0f );     break;
             * case Data.ChTypeId.MonumentB: shapeColl.Set( 0, StaticDataList.getVectorZero(), new Vector3(0.0f, 0.75f, 0.0f), 0.5f );    break;
             * case Data.ChTypeId.MonumentC: shapeColl.Set( 0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 1.0f );     break;
             * }
             */
        }
Beispiel #10
0
/// public メソッド
///---------------------------------------------------------------------------

/*
 *  /// ボーンの姿勢を取得
 *  public Matrix4 GetBoneMatrix( int boneId )
 *  {
 * //        return useMdlHdl.GetBoneMatrix( boneId );
 *  }
 */
        /// モデルのセット
        public void SetMdlHandle(Data.ChTypeId chTypeId)
        {
            //	shapeColl.Set( 0, StaticDataList.getVectorZero(), 0.001f );
            shapeColl.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 20.0f);

/*        switch( chTypeId ){
 *      case Data.ChTypeId.WallA: shapeColl.Set( 0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 1.0f );     break;
 *      case Data.ChTypeId.WallB: shapeColl.Set( 0, StaticDataList.getVectorZero(), new Vector3(0.0f, 0.75f, 0.0f), 0.5f );    break;
 *      case Data.ChTypeId.WallC: shapeColl.Set( 0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 1.0f );     break;
 *      }
 */
        }
Beispiel #11
0
/// 継承メソッド
///---------------------------------------------------------------------------

        /// 初期化
        public override bool DoInit()
        {
            shapeMove = null;

            shapeMove = new ShapeSphere();
            shapeMove.Init(1);
            shapeMove.Set(0, StaticDataList.getVectorZero(), objWidth);

//		titanModel = new BasicModel("/Application/res/data/3D/char/titan.mdx", 0);
            program = new BasicProgram();
            return(true);
        }
        /// 衝突後の移動座標をセット(三角形との衝突)
        private void setScrapedMovePosTriangle(GameActorCollManager collMgr, Vector3 movePos, ShapeTriangles shapeTri)
        {
            ShapeSphere moveSph = (ShapeSphere)collMgr.MoveShape;
            int         primId  = collMgr.TrgContainer.GetEntryPrimId(0);

            Vector3 collPos    = StaticDataList.getVectorZero();
            float   scrapedPow = (moveSph.Sphre.R + 0.001f);

            /// 点と面上の最近接点を求める
            DemoGame.CommonCollision.GetClosestPtPosPlane(movePos, shapeTri.Triangle[primId].Plane, ref collPos);

            /// 移動候補座標更新
            nextPos.X = collPos.X + (scrapedPow * (shapeTri.Triangle[primId].Plane.Nor.X));
            nextPos.Y = collPos.Y + (scrapedPow * (shapeTri.Triangle[primId].Plane.Nor.Y));
            nextPos.Z = collPos.Z + (scrapedPow * (shapeTri.Triangle[primId].Plane.Nor.Z));
        }
Beispiel #13
0
        public void ClearMakeWall()
        {
            towerPos.Xyz  = StaticDataList.getVectorZero();
            effectPos.Xyz = StaticDataList.getVectorZero();
            if (mode == 1)
            {
//			ctrlResMgr.CtrlHobit.SetCtrlStateId(CtrlHobitemy.CtrlStateId.Eat);
//			ctrlResMgr.CtrlCam.SetCamMode( CtrlCamera.ModeId.LookMyself );
            }
            mode                    = 0;
            TouchCount              = 0;
            makeTowerFlag           = true;
            destinationFlg          = false;
            actorDestination.Enable = false;
            destinationTrgActor     = null;
        }
Beispiel #14
0
/// 継承メソッド
///---------------------------------------------------------------------------

        /// 初期化
        public override bool DoInit()
        {
            shapeMove = null;

            shapeMove = new ShapeSphere();
            shapeMove.Init(1);
            shapeMove.Set(0, StaticDataList.getVectorZero(), 0.4f);

            shapeColl = new ShapeCapsule();
            shapeColl.Init(1);
            shapeColl.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TitanSize);

            shapeCollforDis = new ShapeCapsule();
            shapeCollforDis.Init(1);
            shapeCollforDis.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TouchSize);

            return(true);
        }
Beispiel #15
0
        /// 初期化
        public override bool DoInit()
        {
            shapeMove = null;

            shapeMove = new ShapeSphere();
            shapeMove.Init(1);
            shapeMove.Set(0, StaticDataList.getVectorZero(), 0.4f);

            shapeColl = new ShapeCapsule();
            shapeColl.Init(1);
            shapeColl.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TitanSize);

            shapeCollforDis = new ShapeCapsule();
            shapeCollforDis.Init(1);
            shapeCollforDis.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TouchSize);
            farFlag       = false;
            countForHouse = (int)Data.SetupValue.NewHouseAppearTime;
            return(true);
        }
Beispiel #16
0
/// public メソッド
///---------------------------------------------------------------------------

/*
 *  /// ボーンの姿勢を取得
 *  public Matrix4 GetBoneMatrix( int boneId )
 *  {
 * //        return useMdlHdl.GetBoneMatrix( boneId );
 *  }
 */
        /// モデルのセット
        public void SetMdlHandle(Data.ChTypeId chTypeId)
        {
            int chTypeIdx = (int)chTypeId;
            int mdlResIdx = (int)Data.ModelResId.Hero + chTypeIdx;
            int texResIdx = (int)Data.ModelTexResId.Hero + chTypeIdx;

//        Data.ModelDataManager    resMgr = Data.ModelDataManager.GetInstance();//
//        useMdlHdl.Start( resMgr.GetModel( mdlResIdx ), resMgr.GetTextureContainer( texResIdx ), resMgr.GetShaderContainer( shaResIdx )    );

            //	shapeColl.Set( 0, StaticDataList.getVectorZero(), 0.001f );
            shapeColl.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 20.0f);

/*        switch( chTypeId ){
 *      case Data.ChTypeId.WallA: shapeColl.Set( 0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 1.0f );     break;
 *      case Data.ChTypeId.WallB: shapeColl.Set( 0, StaticDataList.getVectorZero(), new Vector3(0.0f, 0.75f, 0.0f), 0.5f );    break;
 *      case Data.ChTypeId.WallC: shapeColl.Set( 0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 1.0f );     break;
 *      }
 */
        }
Beispiel #17
0
        /// 初期化
        public override bool DoInit()
        {
            shapeMove = null;

            shapeMove = new ShapeSphere();
            shapeMove.Init(1);
            shapeMove.Set(0, StaticDataList.getVectorZero(), 0.4f);

            shapeColl = new ShapeCapsule();
            shapeColl.Init(1);
            shapeColl.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TitanSize);

            shapeCollforDis = new ShapeCapsule();
            shapeCollforDis.Init(1);
            shapeCollforDis.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), (float)Data.SetupValue.TouchSize);

            glowCounter = 0;
            scale       = (int)Data.SetupValue.TowerScale / 100.0f;
            farFlag     = false;
            return(true);
        }
Beispiel #18
0
        /// 衝突後の移動座標をセット(三角形との衝突)
        public void setScrapedMovePosTriangle(GameActorCollManager collMgr, Vector3 movePos, ShapeTriangles shapeTri)
        {
            ShapeSphere moveSph = (ShapeSphere)collMgr.MoveShape;
            int         primId  = collMgr.TrgContainer.GetEntryPrimId(0);

            Vector3 collPos    = StaticDataList.getVectorZero();
            float   scrapedPow = (moveSph.Sphre.R + 0.001f);

            /// 弾く力の算出
            moveMoveCap.Set(moveSph.Sphre.Pos, movePos, moveSph.Sphre.R);
            DemoGame.CommonCollision.CheckSphereAndTriangle(moveMoveCap, shapeTri.Triangle[primId], ref collPos);

            /// 移動候補座標更新
            nextPos.X = moveSph.Sphre.Pos.X;
            nextPos.Y = collPos.Y + (scrapedPow * (shapeTri.Triangle[primId].Plane.Nor.Y));
            nextPos.Z = moveSph.Sphre.Pos.Z;

            touchGroundType = shapeTri.CollisionType;
            touchGroundFlg  = true;

            treadVec = shapeTri.Triangle[primId].Plane.Nor;
        }
Beispiel #19
0
        /// 重力処理
        public void FrameGravity(bool flag)
        {
            if (useCollMgr != null)
            {
                useCollMgr.MoveShape.SetMult(baseMtx);
                Vector3 movePos = StaticDataList.getVectorZero();
                calCollGrav.GetMovePos(useCollMgr, ref movePos);

                if (calCollGrav.Check(useCollMgr, movePos) == true)
                {
                    /// OBJに接地
                    basePos = calCollGrav.NextPos;
                }
                else
                {
                    //設置していない
                }
            }
            Common.MatrixUtil.SetTranslate(ref baseMtx, basePos);
            playId     &= ~PlayId.Move;
            isUpdateMtx = true;
        }
        /// カプセルと三角形との衝突
        public bool Check(DemoGame.GeometryLine moveLine, ShapeTriangles trgShape)
        {
            Vector3 collPos = StaticDataList.getVectorZero();

            calMovePos = moveLine.EndPos;
            calBestDis = -1.0f;
            calBestId  = -1;

            float checDis = moveLine.Length + collCheckDis;

            for (int i = 0; i < trgShape.EntryNum; i++)
            {
                float a = (calMovePos.Dot(trgShape.Triangle[i].Plane.Nor) + trgShape.Triangle[i].Plane.D);
                if (a >= checDis || a <= -checDis)
                {
                    continue;
                }

                if (DemoGame.CommonCollision.CheckLineAndTriangle(moveLine, trgShape.Triangle[i], ref collPos) == true)
                {
                    float dis = Common.VectorUtil.Distance(collPos, moveLine.StartPos);
                    if (dis < calBestDis || calBestId < 0)
                    {
                        calMovePos = collPos;
                        calBestDis = dis;
                        calBestId  = i;
                    }
                }
                AppDebug.CollCnt++;
            }

            if (calBestId >= 0)
            {
                return(true);
            }
            return(false);
        }
Beispiel #21
0
        /// 死亡
        private bool statePlayDead()
        {
            Vector3 effPos = StaticDataList.getVectorZero();

            switch (statePlayTask)
            {
            case 0:
                AppSound.GetInstance().PlaySeCamDis(AppSound.SeId.ObjBreak, BasePos);
                deadCnt = 0;
                statePlayTask++;
                break;

            /// エフェクト余韻
            case 1:
                deadCnt++;
                if (deadCnt >= 15)
                {
                    Enable = false;
                }
                break;
            }

            return(true);
        }
Beispiel #22
0
        /// 死亡
        private bool statePlayDead()
        {
            Vector3 effPos = StaticDataList.getVectorZero();

            switch (statePlayTask)
            {
            /// 死亡セット
            case 0:
                //           mvtHdl.SetPlayMvt( (int)Data.ChMvtResId.Dead, false );

                /// 攻撃対象の方向へ向く
                if (dmgTrgObj != null)
                {
                    Vector4 x   = new Vector4(0, 0, 0, 0);
                    Vector4 y   = new Vector4(0, 0, 0, 0);
                    Vector4 z   = new Vector4(0, 0, 0, 0);
                    Vector4 w   = new Vector4(0, 0, 0, 0);
                    Matrix4 mtx = new Matrix4(x, y, z, w);
                    Vector3 vec;
                    vec.X = dmgTrgObj.Mtx.M41 - objCh.Mtx.M41;
                    vec.Y = 0.0f;
                    vec.Z = dmgTrgObj.Mtx.M43 - objCh.Mtx.M43;
                    Common.MatrixUtil.LookTrgVec(ref mtx, vec);
                    Common.MatrixUtil.SetTranslate(ref mtx, BasePos);
                    this.SetPlace(mtx);
                }
                statePlayTask++;
                break;

            /// 終了待ち
            case 1:
//            if( mvtHdl.IsActive() == false ){

                //Common.VectorUtil.Set( ref effPos, objCh.BodyPos.X, objCh.BodyPos.Y, objCh.BodyPos.Z );

/*
 *              switch(chTypeId){
 *              case Data.ChTypeId.MonsterA:        effPos.Y -= 0.6f;            break;
 *              case Data.ChTypeId.MonsterB:        effPos.Y -= 0.1f;            break;
 *              case Data.ChTypeId.MonsterC:        effPos.Y -= 0.1f;            break;
 *              }
 */

//                EventCntr.Add( ActorEventId.Effect, (int)Data.EffTypeId.Eff05, effPos );

                AppSound.GetInstance().PlaySeCamDis(AppSound.SeId.ObjBreak, BasePos);
                deadCnt = 0;
                statePlayTask++;
                break;

            /// エフェクト余韻
            case 2:
                deadCnt++;
                if (deadCnt >= 15)
                {
                    Enable = false;
                }
                break;
            }

            return(true);
        }
Beispiel #23
0
/// public メソッド
///---------------------------------------------------------------------------

/*
 *  /// ボーンの姿勢を取得
 *  public Matrix4 GetBoneMatrix( int boneId )
 *  {
 * //        return useMdlHdl.GetBoneMatrix( boneId );
 *  }
 */
        /// モデルのセット
        public void SetMdlHandle(Data.ChTypeId chTypeId)
        {
            //	shapeColl.Set( 0, StaticDataList.getVectorZero(), 0.001f );
            shapeColl.Set(0, StaticDataList.getVectorZero(), new Vector3(0.0f, 2.0f, 0.0f), 20.0f);
        }