Exemplo n.º 1
0
        public override void Update(GameInfo gameInfo, Input input)
        {
            base.Update(gameInfo, input);
            if (input.PushABXY(PlayerIndex))
            {
                Attack();
            }
            Vector2 leftStick = input.LeftStick(PlayerIndex);
            if (Math.Abs(leftStick.X) < 0.5 && leftStick.Y > 0.5)
            {
                Move(Direction.UP);
            }
            else if (Math.Abs(leftStick.X) < 0.5 && leftStick.Y < -0.5)
            {
                Move(Direction.DOWN);
            }
            else if (leftStick.X > 0.5 && Math.Abs(leftStick.Y) < 0.5)
            {
                Move(Direction.RIGHT);
            }
            else if (leftStick.X < -0.5 && Math.Abs(leftStick.Y) < 0.5)
            {
                Move(Direction.LEFT);
            }

            #warning デバッグ用 1Pだけキーボードで操作できる
            #region キーボード操作
            if (PlayerIndex == PlayerIndex.One && !input.GamePadConnect(PlayerIndex.One))
            {
                if (input.PushKey(Keys.Z))
                {
                    Attack();
                }
                if (input.PushKey(Keys.Down))
                {
                    Move(Direction.DOWN);
                }
                if (input.PushKey(Keys.Right))
                {
                    Move(Direction.RIGHT);
                }
                if (input.PushKey(Keys.Up))
                {
                    Move(Direction.UP);
                }
                if (input.PushKey(Keys.Left))
                {
                    Move(Direction.LEFT);
                }
            }
            #endregion
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新する
        /// </summary>
        /// <param name="gameTime">ゲーム内部の時間</param>
        /// <returns>次の場面</returns>
        public Scene Update(GameTime gameTime, Input input)
        {
            // TODO
            // Aボタン:Pressed→Released
            foreach (PlayerIndex index in Enum.GetValues(typeof(PlayerIndex)))
            {
                //誰のどんなボタンでも開始できるようにする。
                if (isStart) break;
                isStart = input.PushABXY(index) || input.PushStart(index) ||input.PushMouseLeftButton();
            }
            if (isStart)
            {
                if (!fadeout.IsFadeOut)
                {
                    fadeout.StartFadeOut();
                    se.Play();
                }
            }

            if (!stopwatch.IsRunning)
            {
                stopwatch.Start();
            }

            fadeout.Update();

            if (stopwatch.ElapsedMilliseconds > 3000)
            {
                if (!fadeout.IsFadeOut)
                {
                    fadeout.StartFadeOut();
                }
            }

            if (fadeout.EndFadeOut && stopwatch.ElapsedMilliseconds > 30000)
            {
                return new CreditScene(content);
            }

            if (fadeout.EndFadeOut)
            {
                return new SelectScene(content);
            }

            return this;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新する
        /// </summary>
        /// <param name="gameTime">ゲーム内部の時間</param>
        /// <returns>次の場面</returns>
        public Scene Update(GameTime gameTime, Input input)
        {
            resultDrawer.Update(gameTime);

            fadeout.Update();
            bool isEnd = false;
            foreach (PlayerIndex index in Enum.GetValues(typeof(PlayerIndex)))
            {
                //誰のどんなボタンでも開始できるようにする。
                if (isEnd) break;
                isEnd = input.PushABXY(index) || input.PushStart(index) || input.PushMouseLeftButton();
            }

            if (isEnd && timer.Elapsed > goNextSceneTime)
            {
                // フェードアウト開始
                se.Play();
                fadeout.StartFadeOut();
            }

            // フェードアウト終了後タイトルシーンに遷移
            if (fadeout.EndFadeOut)
            {
                return new TitleScene(content);
            }

            return this;
        }