/// <summary> /// ランキングシーン /// </summary> /// <param name="content"></param> /// <param name="graphicsDevice"></param> /// <param name="selectStage"></param> public Ranking(ContentManager content, GraphicsDevice graphicsDevice, StageSelect.SelectStage selectStage) { this.content = content; this.graphicsDevice = graphicsDevice; //ステージサイズ取得 this.selectStage = selectStage; LoadContent(); NewRecordFlag = false; DrawFlag = false; //音声初期化 cueBGM = SoundManager.Instance.SoundBank.GetCue("result"); cueBGM.Play(); //フェードアウト初期化 fadeout = new FadeOut(content, graphicsDevice, FadeOut.SceneType.OutGame); }
/// <summary> /// ランキングシーン /// </summary> /// <param name="content"></param> /// <param name="graphicsDevice"></param> /// <param name="totalTime"></param> /// <param name="selectStage"></param> public Ranking(ContentManager content, GraphicsDevice graphicsDevice, TimeSpan totalTime, StageSelect.SelectStage selectStage) { this.content = content; this.graphicsDevice = graphicsDevice; //ステージサイズ取得 this.selectStage = selectStage; //クリア時間取得 this.totalTime = totalTime; LoadContent(); NewRecordFlag = false; DrawFlag = true; //ランキングチェック newRank = checkRancking(totalTime, csvstr); //レコード更新フラグ確認 if (newRank >= 0 && newRank <= 2) NewRecordFlag = true; //音声初期化 cueBGM = SoundManager.Instance.SoundBank.GetCue("result"); cueBGM.Play(); fadeout = new FadeOut(content, graphicsDevice, FadeOut.SceneType.OutGame); }
/// <summary> /// タイトル画面シーン /// </summary> /// <param name="content"></param> /// <param name="graphicsDevice"></param> public Title(ContentManager content, GraphicsDevice graphicsDevice) { this.content = content; this.graphicsDevice = graphicsDevice; //コンテンツ読み込み LoadContent(); animationCounter = 0; //スケールの設定 backScale = new Vector2((float)GameMain.ScreenWidth / background.Width, (float)GameMain.ScreenHeight / background.Height); titleScale = Vector2.One; titleOffset = new Vector2(GameMain.ScreenWidth / 2.0f, 120); playOffset = new Vector2(GameMain.ScreenWidth / 2.0f, 260); rankingOffset = new Vector2(GameMain.ScreenWidth / 2.0f, 370); itemOffset = new Vector2(GameMain.ScreenWidth / 2.0f, 450); targetPosition = new Vector2(200, 0); chickScale = new Vector2(0.3f, 0.3f); chickOffset1 = new Vector2(800, 540); creditOffset1 = new Vector2(chickOffset1.X + 40 + credit.Width / 2.0f, chickOffset1.Y); chickOffset2 = new Vector2(creditOffset1.X + credit.Width / 2.0f + 60, chickOffset1.Y); creditOffset2 = new Vector2(chickOffset2.X + 40 + credit.Width / 2.0f, creditOffset1.Y); chickSpeed = 1.5f; //フェードアウトの初期化 m_alpha = 0.0f; m_alphaIncAmout = 0.02f; //フェードアウト描画サイズ screenBound = new Rectangle(0, 0, GameMain.ScreenWidth, GameMain.ScreenHeight); //黒色でフェードアウト color = new Color(0.0f, 0.0f, 0.0f, m_alpha); select = Select.Play; selectRanking = StageSelect.SelectStage.Regular; cueBGM = SoundManager.Instance.SoundBank.GetCue("title"); cueBGM.Play(); }
/// <summary> /// タイトル画面の更新メソッド /// </summary> public SceneInterface Update(GameTime gameTime) { //フェードアウト後新しい画面に更新 if (m_alpha == 1.0f) switch (select) { case Select.Play: //return new StageSelect(content, graphicsDevice); return new Infomation(content, graphicsDevice); case Select.Ranking: return new Ranking(content, graphicsDevice, selectRanking); } //フェードアウトの更新 if (m_isFadeOut) { updateFadeOut(); return this; } //スペースキー入力で次画面へ移行 if (Input.Instance.PushKey(Keys.Space)) { SoundManager.Instance.SoundBank.PlayCue("ok"); cueBGM.Stop(AudioStopOptions.AsAuthored); m_isFadeOut = true; } // 一つ前の状態を保存 Select prevSelect = select; StageSelect.SelectStage prevSelectRanking = selectRanking; // キー入力 if (Input.Instance.PushKey(Keys.Up)) select--; if (Input.Instance.PushKey(Keys.Down)) select++; if (select < 0) select = 0; if ((int)select >= Enum.GetNames(typeof(Select)).Length) select = (Select)Enum.GetNames(typeof(Select)).Length - 1; if (select == Select.Ranking) { if (Input.Instance.PushKey(Keys.Left)) selectRanking--; if (Input.Instance.PushKey(Keys.Right)) selectRanking++; if (selectRanking < 0) selectRanking = 0; if ((int)selectRanking >= Enum.GetNames(typeof(StageSelect.SelectStage)).Length) selectRanking = (StageSelect.SelectStage)Enum.GetNames(typeof(StageSelect.SelectStage)).Length - 1; } // 前の状態と変わっていたら音を鳴らす if (select != prevSelect || selectRanking != prevSelectRanking) SoundManager.Instance.SoundBank.PlayCue("select"); // アニメーションの更新 animationCounter++; animationCounter %= chickAnimation.Length; //chickOffset1.X -= chickSpeed; //if (chickOffset1.X < -100) // chickOffset1.X = GameMain.ScreenWidth * 2 - 100; //chickOffset2.X -= chickSpeed; //if (chickOffset2.X < -100) // chickOffset2.X = GameMain.ScreenWidth * 2 - 100; //creditOffset1.X -= chickSpeed; //if (creditOffset1.X < -credit.Width / 2.0) // creditOffset1.X = GameMain.ScreenWidth * 2 - 100 + credit.Width / 2.0f; //creditOffset2.X -= chickSpeed; //if (creditOffset2.X < -credit.Width / 2.0) // creditOffset2.X = GameMain.ScreenWidth * 2 - 100 + credit.Width / 2.0f; chickOffset1.X -= chickSpeed; if (chickOffset1.X < -100) chickOffset1.X = creditOffset2.X + credit.Width / 2.0f + 60; creditOffset1.X -= chickSpeed; if (creditOffset1.X < -credit.Width / 2.0) creditOffset1.X = chickOffset1.X + 40 + credit.Width / 2.0f; chickOffset2.X -= chickSpeed; if (chickOffset2.X < -100) chickOffset2.X = creditOffset1.X + credit.Width / 2.0f + 60; creditOffset2.X -= chickSpeed; if (creditOffset2.X < -credit.Width / 2.0) creditOffset2.X = chickOffset2.X + 40 + credit.Width / 2.0f; return this; }
/// <summary> /// メインゲームシーン /// </summary> /// <param name="content"></param> /// <param name="graphicsDevice"></param> /// <param name="input"></param> public GameIn(ContentManager content, GraphicsDevice graphicsDevice, GameTime gameTime, StageSelect.SelectStage selectStage, StageSelect.SelectEnemy selectEnemy) { this.content = content; this.graphicsDevice = graphicsDevice; this.selectStage = selectStage; // 乱数の初期化 rand = new Random(); // 迷路初期化。難易度によって大きさを変える maze = new Maze(content, selectStage); Point playerPosition; Point goalPosition; while (true) { playerPosition = maze.RandomPoint(); goalPosition = maze.RandomPoint(); // 迷路の斜辺の長さを求める。三平方の定理 c^2 = sqrt(a^2 + b^2) double hypotenuse = Math.Sqrt(maze.Width * maze.Width + maze.Height * maze.Height); // 0.5斜辺 < 距離 < 0.6斜辺ならOK double distance = Math.Sqrt((playerPosition.X - goalPosition.X) * (playerPosition.X - goalPosition.X) + (playerPosition.Y - goalPosition.Y) * (playerPosition.Y - goalPosition.Y)); if (hypotenuse * 0.5 < distance && distance < hypotenuse * 0.6) { break; } } //プレイヤー初期化 player = new Player(content, playerPosition, Collidable.Collidable.Orientation.East, maze); //ゴール初期化 goalobj = new GoalObject(content, goalPosition, Collidable.Collidable.Orientation.East, maze); // Enemyマネージャ初期化 enemyManager = new EnemyManager(content, selectEnemy, selectStage, maze, player); //背景モデルの宣言 backmodel = new BackGround(content); //カメラの初期設定 camera = new Camera(player); // ミニマップの初期化 miniMap = new MiniMap(content, graphicsDevice); // スコアの初期化 score = new Score(content, graphicsDevice, gameTime, selectStage); //フェードアウト処理 fadeout = new FadeOut(content, graphicsDevice, FadeOut.SceneType.InGame); // カウントダウン countdown = new CountDown(content, graphicsDevice, gameTime); // BGMの再生 cueBGM = SoundManager.Instance.SoundBank.GetCue("game"); }
/// <summary> /// キー入力を行いランキング用CSVを更新するクラス /// </summary> /// <param name="content"></param> /// <param name="graphicsDevice"></param> /// <param name="ranknumber">更新されるランキング順位</param> /// <param name="scoretime">スコアタイム</param> /// <param name="csvfime">CSVファイルの中身</param> /// <param name="selectStage"></param> public KeyBoardInput(ContentManager content, GraphicsDevice graphicsDevice, int ranknumber, string recordtime, StageSelect.SelectStage selectStage) { this.content = content; this.graphicsDevice = graphicsDevice; this.rankNumber = ranknumber; this.recordtime = recordtime; this.selectStage = selectStage; LoadContent(); DecideFlag = false; FinalDecideFlag = false; nametext = ""; }