Example #1
0
        public void Update(GameTime gameTime)
        {
            if (creditpos.Y >= 0)
            {
                creditpos.Y -= 10;
            }

            if (textpos.Y <= Parameter.TextHeight)
            {
                textpos.Y += 10;
            }

            time.Update();

            if (time.IsTime())
            {
                alphaflag = !alphaflag;
                alpha     = alphaflag ? 1.0f : 0.5f;
                time.Initialize();
            }

            if (inputState.CheckDownKey(Keys.X, Buttons.B))
            {
                isEnd = true;
            }
        }
Example #2
0
        public void GetControl(GameTime gameTime, ref Vector2 position, ref Vector2 velocity, ref BulletFactory bf)
        {
            fireTimer.Update(gameTime, Parameters.GameSpeed);

            velocity  = input.Velocity() * player.MoveSpeed;
            position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds * Parameters.GameSpeed;

            position = Vector2.Clamp(position, Vector2.Zero, new Vector2(Screen.GameWidth, Screen.GameHeight));

            if (input.CheckDownKey(Keys.Space, Buttons.RightTrigger) && fireTimer.IsTime())
            {
                bf.Fire(fireDirection * 1000);
                fireTimer.Initialize();
                ShootingGame.GetGameDevice().GetSound().PlaySE("shot");
            }
        }
Example #3
0
        public void Update(GameTime gameTime)
        {
            if (isClear && mapIndex == StageDef.BigIndexMax * StageDef.SmallIndexMax - 1)
            {
                clearSelect.GetSelect = 0;
                isEnd = true;
                return;
            }

            StartTimer.Update();
            if (StartTimer.IsTime())
            {
                StartTimer.Stop();
            }

            ClearShow();

            //死んでいないと更新する
            if (!isClear && !isOver && !isPause)
            {
                //カメラ操作中、別の操作は不可
                if (input.CheckDownKey(Parameter.CameraKey, Parameter.CameraButton))
                {
                    isView        = true;
                    player.IsView = isView;
                }
                else
                {
                    isView        = false;
                    player.IsView = isView;
                }

                if (isView)
                {
                    CameraControl();
                }

                //Goal出現の時に、全画面の更新を一時停止、Goalの演出だけをする By 張ユービン
                if (goal.State == GoalState.APPEARING)
                {
                    FuncSwitch.AllAnimetionPause = true;

                    goal.Update(gameTime);
                    camera.MoveAimPosition(goal.Position + new Vector2(goal.Width / 2, goal.Height / 2));
                }
                else
                {
                    FuncSwitch.AllAnimetionPause = false;
                    playTime++;

                    for (int i = 0; i < map.MapThings.Count; i++)
                    {
                        map.MapThings[i].Update(gameTime);
                    }

                    //プレイヤーの更新
                    player.Update(gameTime);

                    //火の更新
                    for (int i = fires.Count - 1; i >= 0; i--)
                    {
                        fires[i].Update(gameTime);
                    }

                    //死んだ火を消す
                    fires.RemoveAll(x => x.IsDead); // && x.IsOnGround

                    //水の更新
                    foreach (var w in waterLines)
                    {
                        w.Update(gameTime);
                    }

                    waterLines.RemoveAll(x => x.IsDead);

                    //マップの更新
                    map.Update(gameTime);

                    //カメラの注視位置を更新
                    if (!isView)
                    {
                        camera.MoveAimPosition(player.Position + new Vector2(player.Width / 2, player.Height / 2));
                    }
                    //Console.WriteLine(camera.OffSet);

                    //マップ上にある炭の数を取得
                    nowCoals = map.MapThings.FindAll(x => x is Coal);

                    ChangeGoalStage(gameTime);

                    Goal();     //ゴール後処理  by柏  2016.12.22

                    //葉梨竜太
                    if (player.IsDead)
                    {
                        isOver = true;
                        //isClear = true;
                        //clearSelect.IsClear = true;
                    }
                }
            }
            else
            {
                FuncSwitch.AllAnimetionPause = false;
                sound.StopBGM();
            }

            // ClearWindow2が出るように変更(KeyもQに変更) By佐瀬拓海
            if (!player.IsDead && !isClear)
            {
                if (gameDevice.GetInputState().CheckTriggerKey(Keys.Q, Parameter.MenuButton))
                {
                    if (isOver == false)
                    {
                        sound.PlaySE("pauseMenu");  //by柏 2016.12.14 SE実装

                        //全体Animationを一時停止
                        isPause               = true;
                        clearSelect.IsPause   = isPause;
                        clearSelect.GetSelect = 1;
                        isOver = true;
                    }
                    else if (isOver == true)
                    {
                        sound.PlaySE("pauseMenu");  //by柏 2016.12.14 SE実装

                        //全体Animationを一時停止解除
                        isPause             = false;
                        clearSelect.IsPause = isPause;
                        isOver = false;
                    }
                }
            }

            clearSelect.Update();
            isEnd = clearSelect.IsEnd;  //clear窓口からend状態をとる
            if (isOver)                 //SceneのisOverで判断する
            {
                if (player.IsDead)
                {
                    //player.Death();
                }
                if (isPause)
                {
                    clearSelect.IsClear = true;
                    return;
                }
                else
                {
                    if (clearSelect.IsClear)
                    {
                        return;
                    }
                }
                if (clearSelect.IsClear)
                {
                    return;
                }
                clearSelect.Initialize();
                clearSelect.IsClear = true;
            }
            else if (!isOver && !isClear && !isPause)   //isOver = falseでゲーム画面に戻れる By佐瀬拓海
            {
                clearSelect.Initialize();
                clearSelect.IsClear = false;
                sound.PlayBGM("forest1");
            }
        }
Example #4
0
        /// <summary>
        /// 火を投げる
        /// </summary>
        private void ThrowFire()
        {
            //投げ出した火の位置と速度を計算(初期位置は自身とぶつからないように)
            //Speedを固定にした
            //上下左右にした


            isthrow = true;

            if (diretion == Direction.UP || inputState.CheckDownKey(Keys.Up, Buttons.LeftThumbstickUp))
            {
                aim    = new Vector2(0, -Parameter.FireSpeed);
                aimpos = new Vector2(position.X, position.Y - 48);
            }
            else if (diretion == Direction.DOWN || inputState.CheckDownKey(Keys.Down, Buttons.LeftThumbstickDown))
            {
                aim     = new Vector2(0, Parameter.FireSpeed);
                aimpos  = new Vector2(position.X, position.Y + 60);
                isthrow = isOnGround ? false : true;
            }
            else if (diretion == Direction.LEFT || inputState.CheckDownKey(Keys.Left, Buttons.LeftThumbstickLeft))
            {
                aim    = new Vector2(-Parameter.FireSpeed, 0);
                aimpos = new Vector2(position.X - 50, position.Y);
            }
            else if (diretion == Direction.RIGHT || inputState.CheckDownKey(Keys.Right, Buttons.LeftThumbstickRight))
            {
                aim    = new Vector2(Parameter.FireSpeed, 0);
                aimpos = new Vector2(position.X + 50, position.Y);
            }

            if (fireNum > 0)
            {
                if (inputState.CheckTriggerKey(Parameter.ThrowKey, Parameter.ThrowButton))
                {
                    if (isthrow)
                    {
                        Vector2 fireVelo = aim;
                        Vector2 firePos  = aimpos;

                        Fire fire = new Fire(firePos, fireVelo, watersList);
                        //葉梨竜太
                        //単位ベクトル化
                        fireVelo.Normalize();
                        fire.Velocity = fireVelo * Parameter.FireSpeed;
                        //葉梨竜太
                        fire.SetStartPos();

                        firesList.Insert(0, fire);
                        fireNum--;
                    }


                    //投げる状態に入る
                    animePlayer.PlayAnimation(throwAnime);
                    playerMotion = PlayerMotion.THROW;
                    sound.PlaySE("fire1");
                }
                aim.Normalize();
                aimpos.X = aimpos.X + (Parameter.FireFly * 64 * aim.X);
                aimpos.Y = aimpos.Y + (Parameter.FireFly * 64 * aim.Y);
                AimCheck();
            }
        }