/// 備品の登録 ///--------------------------------------------------------------------------- public bool frameFixEntry() { DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; /// 初期化 if (nowSubTask == 0) { enemyId = 0; nowSubTask++; } if ((pad.Trig & DemoGame.InputGamePadState.Up) != 0) { enemyId--; if (enemyId < 0) { enemyId = fixEntryStringList.Length - 1; } } if ((pad.Trig & DemoGame.InputGamePadState.Down) != 0) { enemyId = (enemyId + 1) % fixEntryStringList.Length; } return(true); }
/// 敵パラメータのセット ///--------------------------------------------------------------------------- public bool frameEnemyParam() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { changeTask(debugMenuTaskId.MenuTop); return(true); } if (nowSubTask == 0) { enemyId = 0; nowSubTask++; } if ((pad.Trig & DemoGame.InputGamePadState.Up) != 0) { enemyId--; if (enemyId < 0) { enemyId = 1; } } if ((pad.Trig & DemoGame.InputGamePadState.Down) != 0) { enemyId = (enemyId + 1) % 2; } pad.SetRepeatParam(10, 2); if (enemyId == 0) { /* if( (pad.Repeat & DemoGame.InputGamePadState.Left) != 0 ){ * ctrlResMgr.CtrlEn.EntryAreaDis -= 0.5f; * } * else if( (pad.Repeat & DemoGame.InputGamePadState.Right) != 0 ){ * ctrlResMgr.CtrlEn.EntryAreaDis += 0.5f; * } */ } else { if ((pad.Repeat & DemoGame.InputGamePadState.Left) != 0) { ctrlResMgr.CtrlHobit.EntryStayMax--; } else if ((pad.Repeat & DemoGame.InputGamePadState.Right) != 0) { ctrlResMgr.CtrlHobit.EntryStayMax++; } } //ctrlResMgr.CtrlEn.Frame(); return(true); }
/* * public void changeAnimation(bool Flag){ * actorCh.changeAnimation(Flag); * } */ /// フレーム:目的地への移動FPS視点 private bool frameDestinationMoveFps() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); float rotY; float cal; float angleY; float mPow = moveSpeed; /// 目的地が設定されている場合 ///---------------------------------------------------- if (ctrlResMgr.CtrlStg.CheckDestinationTrg()) { float trgDis = Common.VectorUtil.DistanceXZ(actorCh.BasePos, ctrlResMgr.CtrlStg.GetDestinationPos()); GameActorProduct trgActor = ctrlResMgr.CtrlStg.GetDestinationActor(); ShapeSphere bndSph = trgActor.GetBoundingShape(); if (mPow > trgDis) { mPow = trgDis; } /// 目的地到着 if (trgDis <= mPow || (bndSph != null && trgDis <= bndSph.Sphre.R * 1.5f)) { ctrlResMgr.CtrlStg.ClearDestination(); actorCh.SetStateMove(new Vector3(actorCh.BaseMtx.M31, actorCh.BaseMtx.M32, actorCh.BaseMtx.M33), mPow, 0, false); if (bndSph != null) { actorCh.Frame(); setPlayMode(PlayModeId.Normal); actorCh.SetStateAttack(0); } return(false); } actorCh.SetLookTrgPos(ctrlResMgr.CtrlStg.GetDestinationPos()); } /// 直進移動 ///---------------------------------------------------- else { rotY = 180.0f + ctrlResMgr.CtrlCam.GetCamRotY() + AppInput.GetInstance().GetPlRotY(); cal = (float)(3.141593f / 180.0); angleY = rotY * cal; actorCh.BaseMtx = Matrix4.RotationY(angleY); Common.MatrixUtil.SetTranslate(ref actorCh.BaseMtx, actorCh.BasePos); actorCh.SetPlace(actorCh.BaseMtx); } actorCh.SetStateMove(new Vector3(actorCh.BaseMtx.M31, actorCh.BaseMtx.M32, actorCh.BaseMtx.M33), mPow, 0, false); return(true); }
/// フレーム処理 public bool Update() { switch (taskId) { case 0: if (AppSound.GetInstance().IsBgmPlaing() == false) { AppLyout.GetInstance().SetSprite(AppLyout.SpriteId.TouchScreen); taskId++; } break; case 1: if (AppInput.GetInstance().TouchRelease == true) { alphaCnt = 0; AppDispEff.GetInstance().SetFadeOut(0xffffff, 5, true); taskId++; break; } alphaCnt++; if (alphaCnt < 100) { alpha += 0.02f; if (alpha >= 1.0f) { alpha = 1.0f; alphaCnt = 100; } } else { alpha -= 0.02f; if (alpha < 0.25f) { alpha = 0.25f; alphaCnt = 0; } } break; case 2: if (AppDispEff.GetInstance().NowEffId != AppDispEff.EffId.FadeOut) { useSceneMgr.Next((new SceneTitle()), false); } alpha = 0.0f; break; } GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); ctrlResMgr.FrameResult(); AppLyout.GetInstance().SetAlpha(AppLyout.SpriteId.TouchScreen, alpha); return(true); }
/// メニュートップ ///--------------------------------------------------------------------------- public bool frameMenuTop() { DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; /// デバックモードを抜ける if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { useSceneMgr.Prev(); return(true); } if ((pad.Trig & DemoGame.InputGamePadState.Up) != 0) { topMenuId--; if (topMenuId < 0) { topMenuId = menuTopStringList.Length - 1; } } if ((pad.Trig & DemoGame.InputGamePadState.Down) != 0) { topMenuId = (topMenuId + 1) % menuTopStringList.Length; } if ((pad.Trig & DemoGame.InputGamePadState.Circle) != 0) { switch (topMenuId) { case 0: changeTask(debugMenuTaskId.EnemyEntry); break; case 1: changeTask(debugMenuTaskId.EnemyPlace); break; case 2: changeTask(debugMenuTaskId.FixEntry); break; case 3: changeTask(debugMenuTaskId.FixPlace); break; case 4: changeTask(debugMenuTaskId.LodParam); break; case 5: changeTask(debugMenuTaskId.EnemyParam); break; case 6: changeTask(debugMenuTaskId.EffCheck); break; case 7: changeTask(debugMenuTaskId.SoundCheck); break; case 8: changeTask(debugMenuTaskId.GameSetup); break; case 9: changeTask(debugMenuTaskId.UpdatePlace); break; case 10: changeTask(debugMenuTaskId.SavePlaceParam); break; } } return(true); }
/// フレーム:FPS移動 private bool frameMoveFps() { Matrix4 rotMtx; float rotY; float cal; float angleY; GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); /// カメラの方向を常に向く ///-------------------------------------------- setCamVecTurn(); /// カメラモード切替 ///-------------------------------------------- if (ctrlResMgr.CtrlCam.CheckModeChange()) { setPlayMode(PlayModeId.Normal); return(true); } /// 移動 ///-------------------------------------------- if ((AppInput.GetInstance().Event & AppInput.EventId.Move) != 0) { rotY = 180.0f + ctrlResMgr.CtrlCam.GetCamRotY() + AppInput.GetInstance().GetPlRotY(); cal = (float)(3.141593f / 180.0); angleY = rotY * cal; rotMtx = Matrix4.RotationY(angleY); actorCh.SetStateMove(new Vector3(rotMtx.M31, rotMtx.M32, rotMtx.M33), moveSpeed, 0.0f, false); /// キー入力が入った場合には目的地をキャンセル ctrlResMgr.CtrlStg.ClearDestination(); } /// 目的地への移動 ///-------------------------------------------- else if (ctrlResMgr.CtrlStg.CheckDestination()) { frameDestinationMoveFps(); } /// 待機 ///-------------------------------------------- else { actorCh.SetStateStand(); } return(true); }
/// private メソッド ///--------------------------------------------------------------------------- /// 入力イベントのチェック private void checkInputButtons() { int devPosX = AppInput.GetInstance().DevicePosX; int devPosY = AppInput.GetInstance().DevicePosY; eventState = 0; /// ゲームスタートチェック if (AppInput.GetInstance().CheckDeviceSingleTouchDown() == true) { eventState = EveStateId.GameStart; } }
/// ゲーム制御系セットアップ ///--------------------------------------------------------------------------- public bool frameGameSetup() { DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; /// 初期化 if (nowSubTask == 0) { gameSetupId = 0; nowSubTask++; } if ((pad.Trig & DemoGame.InputGamePadState.Up) != 0) { gameSetupId--; if (gameSetupId < 0) { gameSetupId = gameSetupStringList.Length - 1; } } if ((pad.Trig & DemoGame.InputGamePadState.Down) != 0) { gameSetupId = (gameSetupId + 1) % gameSetupStringList.Length; } /// セットアップ if ((pad.Trig & DemoGame.InputGamePadState.Circle) != 0) { switch (gameSetupId) { case 0: AppDebug.PlDrawFlg = (AppDebug.PlDrawFlg == false)? true : false; break; case 1: AppDebug.ToonFlg = (AppDebug.ToonFlg == false)? true : false; break; case 2: AppDebug.AtkStepPlay = (AppDebug.AtkStepPlay == false)? true : false; break; case 3: AppDebug.GravityFlg = (AppDebug.GravityFlg == false)? true : false; break; case 4: AppDebug.CollLightFlg = (AppDebug.CollLightFlg == false)? true : false; break; } } /// 戻る else if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { changeTask(debugMenuTaskId.MenuTop); } return(true); }
/// 継承メソッド ///--------------------------------------------------------------------------- /// 初期化 public override bool DoInit() { /// シーンマネージャの生成 ///--------------------------------------------- sceneMgr = new DemoGame.SceneManager(); if (sceneMgr.Init() == false) { return(false); } /// デバックパラメータの初期化 ///--------------------------------------------- AppDebug.Init(); /// 入力クラスのセットアップ ///--------------------------------------------- AppInput.GetInstance().Init(inputGPad, inputTouch, graphicsDevice); /// レイアウトクラスのセットアップ ///--------------------------------------------- AppLyout.GetInstance().Init(graphicsDevice); //SocketSample.GetInstance().Init(); //SocketSample.GetInstance().start(); /// シーンパラメータマネージャのセットアップ ///--------------------------------------------- GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); ctrlResMgr.Init(); ctrlResMgr.SetGraphicsDevice(graphicsDevice); /// 画面効果クラスのセットアップ ///--------------------------------------------- AppDispEff.GetInstance().Init(); /// デバック系のセットアップ ///--------------------------------------------- DemoGame.RenderGeometry.Init("/Application/shaders/AmbientColor.cgx", null); sceneMgr.Next((new SceneDataLoad()), false); return(true); }
/// フレーム public override bool DoUpdate() { AppInput.GetInstance().Frame(); if (AppDispEff.GetInstance().Frame()) { return(true); } sceneMgr.Update(); GameCtrlManager.GetInstance().SetFps(GetFps()); GameCtrlManager.GetInstance().SetMs(GetMs()); return(true); }
/// 配置情報の保存 ///--------------------------------------------------------------------------- public bool frameSavePlaceParam() { DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; /// 初期化 if (nowSubTask == 0) { SetupObjPlaceData.Save(); nowSubTask++; } if (pad.Trig != 0) { changeTask(debugMenuTaskId.MenuTop); } return(true); }
/// 敵の登録 ///--------------------------------------------------------------------------- public bool frameEnemyEntry() { DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; /// 初期化 if (nowSubTask == 0) { enemyId = 0; nowSubTask++; } if ((pad.Trig & DemoGame.InputGamePadState.Up) != 0) { enemyId--; if (enemyId < 0) { enemyId = enemyEntryStringList.Length - 1; } } if ((pad.Trig & DemoGame.InputGamePadState.Down) != 0) { enemyId = (enemyId + 1) % enemyEntryStringList.Length; } /// 敵の登録 if ((pad.Trig & DemoGame.InputGamePadState.Circle) != 0) { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); //ctrlResMgr.CtrlEn.EntryAddEnemy( enemyId, 0.0f, ctrlResMgr.CtrlPl.GetPos(),0 ); changeTask(debugMenuTaskId.MenuTop); } /// 戻る else if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { changeTask(debugMenuTaskId.MenuTop); } return(true); }
/// フレーム処理(配置用) public bool FramePlace(Vector3 trgPos) { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; if ((pad.Scan & DemoGame.InputGamePadState.L) != 0) { worldDis -= 0.1f; if (worldDis < 1.0f) { worldDis = 1.0f; } } else if ((pad.Scan & DemoGame.InputGamePadState.R) != 0) { worldDis += 0.1f; } else { worldRot.X += AppInput.GetInstance().CamRotX; worldRot.Y += AppInput.GetInstance().CamRotY; } if (worldRot.Y > 360.0f) { worldRot.Y -= 360.0f; } else if (worldRot.Y < -360.0f) { worldRot.Y += 360.0f; } /// カメラにセットする行列を登録 actorBehind.SetMoveParam(worldMtx, trgPos, worldRot, worldDis, 2); actorBehind.Frame(); ctrlResMgr.GraphDev.SetCurrentCamera(actorBehind.Obj.CameraCore); return(true); }
/// フレーム:移動 private bool frameMove() { float tPow = 0.0f; GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); if ((AppInput.GetInstance().Event & AppInput.EventId.Move) != 0) { tPow = (180.0f + ctrlResMgr.CtrlCam.GetCamRotY() + AppInput.GetInstance().GetPlRotY()); actorCh.SetStateMove(new Vector3(actorCh.BaseMtx.M31, actorCh.BaseMtx.M32, actorCh.BaseMtx.M33), moveSpeed, tPow, false); /// キー入力が入った場合には目的地をキャンセル ctrlResMgr.CtrlStg.ClearDestination(); } /// 目的地への移動 ///-------------------------------------------- else if (ctrlResMgr.CtrlStg.CheckDestination()) { frameDestinationMove(); } /// 待機 else { if (ctrlResMgr.CtrlCam.camModeId == CtrlCamera.ModeId.Normal) { tPow = (180.0f + ctrlResMgr.CtrlCam.GetCamRotY() + AppInput.GetInstance().GetPlRotY()); actorCh.SetStateMove(new Vector3(actorCh.BaseMtx.M31, actorCh.BaseMtx.M32, actorCh.BaseMtx.M33), 0.0f, tPow, false); } else { actorCh.SetStateStand(); } } return(true); }
/// カメラとプレイヤーとの位置関係をセット private void setCamPlBehindFlg() { DemoGame.Camera camCore = GameCtrlManager.GetInstance().CtrlCam.GetCurrentCameraCore(); Vector3 plVec; plVec.X = actorCh.BaseMtx.M31; plVec.Y = actorCh.BaseMtx.M32; plVec.Z = actorCh.BaseMtx.M33; float dot = camCore.LookVec.Dot(plVec); if (dot > 0.0f) { AppInput.GetInstance().SetPlBehind(true); } else { AppInput.GetInstance().SetPlBehind(false); } }
/// LODパラメータのセット ///--------------------------------------------------------------------------- public bool frameLodParam() { DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { changeTask(debugMenuTaskId.MenuTop); return(true); } pad.SetRepeatParam(10, 2); if ((pad.Repeat & DemoGame.InputGamePadState.Left) != 0) { GameCtrlDrawManager.GetInstance().SetLodParam(lodNo, (GameCtrlDrawManager.GetInstance().GetLodParam(lodNo) - 1.0f)); } else if ((pad.Repeat & DemoGame.InputGamePadState.Right) != 0) { GameCtrlDrawManager.GetInstance().SetLodParam(lodNo, (GameCtrlDrawManager.GetInstance().GetLodParam(lodNo) + 1.0f)); } return(true); }
/// private メソッド ///--------------------------------------------------------------------------- /// 通常カメラ private bool frameFieldEyecam() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); worldRot.X += AppInput.GetInstance().CamRotX; worldRot.Y += AppInput.GetInstance().CamRotY; if (worldRot.Y > 360.0f) { worldRot.Y -= 360.0f; } else if (worldRot.Y < -360.0f) { worldRot.Y += 360.0f; } if (worldRot.X > 40.0f) { worldRot.X = 40.0f; } else if (worldRot.X < -40.0f) { worldRot.X = -40.0f; } worldDis = 6.0f; GameObjProduct trgObj = ctrlResMgr.CtrlPl.GetUseActorBaseObj(); Vector3 movePos = new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42 + camBehindY, trgObj.Mtx.M43); /// カメラにセットする行列を登録 actorBehind.SetMoveParam(worldMtx, movePos, worldRot, worldDis, 10, 20, 1); actorBehind.FrameLookSelf(); ctrlResMgr.GraphDev.SetCurrentCamera(actorBehind.Obj.CameraCore); return(true); }
/// フレーム処理(リザルト用) public bool FrameResult() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); worldRot.X += AppInput.GetInstance().CamRotX; worldRot.Y += AppInput.GetInstance().CamRotY; if (worldRot.Y > 360.0f) { worldRot.Y -= 360.0f; } else if (worldRot.Y < -360.0f) { worldRot.Y += 360.0f; } if (worldRot.X > 30.0f) { worldRot.X = 30.0f; } else if (worldRot.X < 0.0f) { worldRot.X = 0.0f; } GameObjProduct trgObj = ctrlResMgr.CtrlPl.GetUseActorBaseObj(); Vector3 movePos = new Vector3(trgObj.Mtx.M41, trgObj.Mtx.M42 + camBehindY, trgObj.Mtx.M43); /// カメラにセットする行列を登録 actorBehind.SetMoveParam(worldMtx, movePos, worldRot, 5.0f, 4); actorBehind.Frame(); ctrlResMgr.GraphDev.SetCurrentCamera(actorBehind.Obj.CameraCore); return(true); }
/// エフェクトチェック ///--------------------------------------------------------------------------- public bool frameEffCheck() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { changeTask(debugMenuTaskId.MenuTop); return(true); } if ((pad.Trig & DemoGame.InputGamePadState.Left) != 0) { effNo--; if (effNo < 0) { effNo = (int)Data.EffTypeId.Max - 1; } } else if ((pad.Trig & DemoGame.InputGamePadState.Right) != 0) { effNo = (effNo + 1) % ((int)Data.EffTypeId.Max); } /// 再生 if ((pad.Trig & DemoGame.InputGamePadState.Circle) != 0) { Vector3 pos = ctrlResMgr.CtrlPl.GetPos(); pos.Y += 2.0f; ctrlResMgr.CtrlEffect.EntryEffect((Data.EffTypeId)effNo, pos); } ctrlResMgr.CtrlEffect.Frame(); return(true); }
/// 破棄 public override bool DoTerm() { if (sceneMgr != null) { sceneMgr.Term(); } sceneMgr = null; GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); ctrlResMgr.Term(); AppDispEff.GetInstance().Term(); AppDebug.Term(); AppInput.GetInstance().Term(); AppLyout.GetInstance().Term(); AppSound.GetInstance().Term(); DemoGame.RenderGeometry.Term(); Data.ModelDataManager.GetInstance().Term(); return(true); }
/// メニュートップ ///--------------------------------------------------------------------------- public bool frameSelectObj() { DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; /// 戻る if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { useSceneMgr.Prev(); return(true); } /// 未登録 if (trgObjMax <= 0) { return(true); } if ((pad.Trig & DemoGame.InputGamePadState.Left) != 0) { trgObjIdx--; if (trgObjIdx < 0) { trgObjIdx = trgObjMax - 1; } setPlaceTrgParam(trgObjIdx); } else if ((pad.Trig & DemoGame.InputGamePadState.Right) != 0) { trgObjIdx = (trgObjIdx + 1) % trgObjMax; setPlaceTrgParam(trgObjIdx); } else if ((pad.Trig & DemoGame.InputGamePadState.Up) != 0) { topMenuId--; if (topMenuId < 0) { topMenuId = menuStringList.Length - 1; } } else if ((pad.Trig & DemoGame.InputGamePadState.Down) != 0) { topMenuId = (topMenuId + 1) % menuStringList.Length; } /// アクションの決定 else if ((pad.Trig & DemoGame.InputGamePadState.Circle) != 0) { switch (topMenuId) { case 0: changeTask(debugMenuTaskId.MoveObj); break; case 1: changeTask(debugMenuTaskId.GravityObj); break; case 2: changeTask(debugMenuTaskId.DeleteObj); break; } } return(true); }
/// フレーム処理 public bool Update() { AppDebug.CheckTimeStart(); #if DEBUG_MODE /// デバックモードへ DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { useSceneMgr.Next((new SceneDebugMenu()), true); return(true); } #endif if ((AppInput.GetInstance().Event & AppInput.EventId.Pause) != 0) { if (pauseFlag == false) { pauseFlag = true; } else if (pauseFlag == true) { pauseFlag = false; } } /// ゲーム制御 if (pauseFlag == false) { ctrlResMgr.Frame(); if (ctrlResMgr.CtrlHobit.changeStateFlag == true) { if (ctrlResMgr.CtrlHobit.stateId == CtrlHobit.CtrlStateId.BattleMove) { outputString = 0; } else if (ctrlResMgr.CtrlHobit.stateId == CtrlHobit.CtrlStateId.Battle) { outputString = 1; } else if (ctrlResMgr.CtrlHobit.stateId == CtrlHobit.CtrlStateId.MurderMove) { outputString = 2; } else if (ctrlResMgr.CtrlHobit.stateId == CtrlHobit.CtrlStateId.Murder) { outputString = 1; } else if (ctrlResMgr.CtrlHobit.stateId == CtrlHobit.CtrlStateId.Move) { outputString = 3; } startMessCnt = 0; ctrlResMgr.CtrlHobit.changeStateFlag = false; } } setupLyout(); AppDebug.CheckTimeEnd(); /// ゲームの終了チェック if (ctrlResMgr.CtrlPl.Hp <= 0 || ctrlResMgr.CtrlHobit.GetEntryNum() <= 0) { useSceneMgr.Next((new SceneGameResult()), true); return(true); } return(true); }
/// サウンドチェック ///--------------------------------------------------------------------------- public bool frameSoundCheck() { DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { changeTask(debugMenuTaskId.MenuTop); return(true); } if ((pad.Trig & DemoGame.InputGamePadState.Up) != 0) { soundTrg--; if (soundTrg < 0) { soundTrg = 1; } } else if ((pad.Trig & DemoGame.InputGamePadState.Down) != 0) { soundTrg = (soundTrg + 1) % 2; } if ((pad.Trig & DemoGame.InputGamePadState.Left) != 0) { if (soundTrg == 0) { soundBgmNo--; if (soundBgmNo < 0) { soundBgmNo = (int)AppSound.BgmId.Max - 1; } } else { soundSeNo--; if (soundSeNo < 0) { soundSeNo = (int)AppSound.SeId.Max - 1; } } } else if ((pad.Trig & DemoGame.InputGamePadState.Right) != 0) { if (soundTrg == 0) { soundBgmNo = (soundBgmNo + 1) % ((int)AppSound.BgmId.Max); } else { soundSeNo = (soundSeNo + 1) % ((int)AppSound.SeId.Max); } } /// 再生 if ((pad.Trig & DemoGame.InputGamePadState.Circle) != 0) { if (soundTrg == 0) { AppSound.GetInstance().PlayBgm((AppSound.BgmId)soundBgmNo, false); } else { AppSound.GetInstance().PlaySe((AppSound.SeId)soundSeNo); } } return(true); }
/// 入力イベントのチェック private void checkInputButtons() { GameCtrlManager ctrlResMgr = GameCtrlManager.GetInstance(); DemoGame.GraphicsDevice useGraphDev = ctrlResMgr.GraphDev; int devPosX = AppInput.GetInstance().DevicePosX; int devPosY = AppInput.GetInstance().DevicePosY; eventState = 0; /// 戻る ///-------------------------------------------------------------- if (AppInput.GetInstance().DeviceInputId >= 0 && AppLyout.GetInstance().CheckRect(AppLyout.SpriteId.Back_on, devPosX, devPosY)) { AppLyout.GetInstance().ClearSprite(AppLyout.SpriteId.Back_off); AppLyout.GetInstance().SetSprite(AppLyout.SpriteId.Back_on); if (AppInput.GetInstance().CheckDeviceSingleTouchUp() == true) { eventState = EveStateId.TitleBack; } } else { AppLyout.GetInstance().ClearSprite(AppLyout.SpriteId.Back_on); AppLyout.GetInstance().SetSprite(AppLyout.SpriteId.Back_off); } /// ページ送り ///-------------------------------------------------------------- if (eventState == 0 && abs(touchMoveX) < useGraphDev.DisplayWidth / 20) { if (AppInput.GetInstance().DeviceInputId >= 0 && devPosX < ((useGraphDev.DisplayWidth / 2) - 374)) { if (pageNow > 0) { if (AppInput.GetInstance().CheckDeviceSingleTouchUp() == true) { eventState = EveStateId.PageBack; } } } else if (AppInput.GetInstance().DeviceInputId >= 0 && devPosX >= ((useGraphDev.DisplayWidth / 2) + 374)) { if (pageNow + 1 < pageMax) { if (AppInput.GetInstance().CheckDeviceSingleTouchUp() == true) { eventState = EveStateId.PageNext; } } } } /// ページ切り替え入力判定 ///-------------------------------------------------------------- if (AppInput.GetInstance().CheckDeviceSingleTouchDown()) { touchStartX = devPosX; touchMoveX = devPosX - touchStartX; touchMoveFlg = true; } if (touchMoveFlg == true && AppInput.GetInstance().CheckDeviceSingleTouching()) { touchMoveX = devPosX - touchStartX; if ((pageNow + 1 >= pageMax && touchMoveX < 0) || (pageNow <= 0 && touchMoveX > 0)) { touchMoveX = 0; } } else if (touchMoveX > 0) { touchMoveX -= (useGraphDev.DisplayWidth / 10); if (touchMoveX < 0) { touchMoveX = 0; } } else if (touchMoveX < 0) { touchMoveX += (useGraphDev.DisplayWidth / 10); if (touchMoveX > 0) { touchMoveX = 0; } } if (AppInput.GetInstance().CheckDeviceSingleTouchUp() == true) { if (touchMoveX >= (useGraphDev.DisplayWidth / 3)) { eventState = EveStateId.PageBack; } else if (touchMoveX < -(useGraphDev.DisplayWidth / 3)) { eventState = EveStateId.PageNext; } } }
/// OBJの移動 ///--------------------------------------------------------------------------- public bool frameMoveObj() { DemoGame.InputGamePad pad = AppInput.GetInstance().Pad; /// 戻る if ((pad.Trig & DemoGame.InputGamePadState.Start) != 0) { changeTask(debugMenuTaskId.SelectObj); return(true); } /// 速度変更 if ((pad.Trig & DemoGame.InputGamePadState.Triangle) != 0) { trgObjMoveSpd += 1.0f; if (trgObjMoveSpd >= 8.0f) { trgObjMoveSpd = 1.0f; } } Vector3 move = new Vector3(0.0f, 0.0f, 0.0f); /// 回転 if ((pad.Scan & DemoGame.InputGamePadState.Square) != 0) { if ((pad.Scan & DemoGame.InputGamePadState.Left) != 0) { trgObjRot.Y -= (1.0f * trgObjMoveSpd); if (trgObjRot.Y <= 0.0f) { trgObjRot.Y += 360.0f; } } if ((pad.Scan & DemoGame.InputGamePadState.Right) != 0) { trgObjRot.Y += (1.0f * trgObjMoveSpd); if (trgObjRot.Y >= 360.0f) { trgObjRot.Y -= 360.0f; } } } /// 移動 else { if ((pad.Scan & DemoGame.InputGamePadState.Left) != 0) { move.X = -1.0f; } if ((pad.Scan & DemoGame.InputGamePadState.Right) != 0) { move.X = 1.0f; } if ((pad.Scan & DemoGame.InputGamePadState.Up) != 0) { move.Z = -1.0f; } if ((pad.Scan & DemoGame.InputGamePadState.Down) != 0) { move.Z = 1.0f; } if ((pad.Scan & DemoGame.InputGamePadState.Circle) != 0) { move.Y = 1.0f; } if ((pad.Scan & DemoGame.InputGamePadState.Cross) != 0) { move.Y = -1.0f; } } setTrgObjMove((move * trgObjMoveSpd * 0.01f)); return(true); }
/// フレーム処理 public bool Frame() { actorStg.Frame(); /// 目標地点が消失5 if (destinationTrgActor != null && destinationTrgActor.Enable == false) { ClearDestination(); } /// 目的地のセット if ((AppInput.GetInstance().Event & AppInput.EventId.DestinationMove) != 0 && makeTowerFlag == true) { if ((AppInput.GetInstance().Event & AppInput.EventId.buttonPress) == 0) { //範囲拡張アイテム設置モード if (MonumentSetFlag == true) { setMonument(AppInput.GetInstance().SingleScrTouchPosX, AppInput.GetInstance().SingleScrTouchPosY); mode = 3; } else { if (mode == 0) { //最初に触ったオブジェクト探し findingTower(AppInput.GetInstance().SingleScrTouchPosX, AppInput.GetInstance().SingleScrTouchPosY); } else if (mode == 2 && makeTowerFlag == true) { //壁の生成 makeWall(AppInput.GetInstance().SingleScrTouchPosX, AppInput.GetInstance().SingleScrTouchPosY); } } } if ((AppInput.GetInstance().Event & AppInput.EventId.buttonPress) != 0) { setEatTarget(AppInput.GetInstance().SingleScrTouchPosX, AppInput.GetInstance().SingleScrTouchPosY); } TouchCount++; /* * if(mode == 0){ * findingMode(AppInput.GetInstance().SingleScrTouchPosX, AppInput.GetInstance().SingleScrTouchPosY); * }else if(mode == 1){ * setEatTarget(AppInput.GetInstance().SingleScrTouchPosX, AppInput.GetInstance().SingleScrTouchPosY); * }else if(mode == 2){ * makeWall(AppInput.GetInstance().SingleScrTouchPosX, AppInput.GetInstance().SingleScrTouchPosY); * }else if(mode == 3){ * setBreakTarget(AppInput.GetInstance().SingleScrTouchPosX, AppInput.GetInstance().SingleScrTouchPosY); * } */ //Console.WriteLine(mode); // destinationFlg = true; } else if ((AppInput.GetInstance().Event & AppInput.EventId.DestinationCancel) != 0) { ClearMakeWall(); // ClearDestination(); } if (actorDestination.Enable) { // actorDestination.Frame(); } return(true); }