Update() public method

public Update ( ) : void
return void
Exemplo n.º 1
0
 public override void Updata(GameTime gameTime)
 {
     if (hp <= 0)
     {
         isDeadFlag = true;
     }
     if (!Input.GetKeyState(Keys.Space))
     {
         velocity.Y -= yVectol;
     }
     else
     {
         velocity.Y += yVectol;
         velocity.X += 0.1f;
     }
     if (Input.IsKeyUp(Keys.Space))
     {
         velocity.X += xVectol;
         //hp -= 100;
     }
     velocity.Y = (ySpeedMax < velocity.Y) ? ySpeedMax : velocity.Y;
     velocity.X = (xSpeedMax < velocity.X) ? xSpeedMax : velocity.X;
     if (velocity.X >= 0)
     {
         velocity.X -= 0.07f;
     }
     position = position + velocity;
     setDisplayModify();
     motion.Update(gameTime);
 }
Exemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            Damege = 1;
            BulletUpdate();
            FallStart();
            JumpUpdate();
            MoveUpdate();
            IsGoal();
            UpdateMotion();
            motion.Update(gameTime);
            IsTrap();
            Ride();
            Invincibly();
            DamgeUpdate();

            if (Hp <= 0)
            {
                isDeadFlag = true;
            }

            if (position.Y >= Screen.Height)
            {
                isDeadFlag = true;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            PlayerMove();
            PlayerJump();
            GroundHit();
            SkillAttack();
            NormalAttack();
            PlayerAvoid();
            motion.Update(gameTime);
            motionRun.Update(gameTime);
            skillmotion.Update(gameTime);
            skillGmotion.Update(gameTime);
            #region Debug確認用
            //Console.WriteLine("HitFlag = " + AttackHitFlag);
            //Console.WriteLine("weakAttackCounter" + weakAttackCounter);
            //Console.WriteLine("ComboFlag = " + ComboFlag);
            //Console.WriteLine("ComboCount= " + comboCount);
            //Console.WriteLine("alpha = " + alpha);
            Console.WriteLine("skill1combo = " + skill1Combo);
            #endregion

            if (AttackHitFlag && comboCount != 0)
            {
                velocity = Vector2.Zero;
            }

            position += velocity;

            if (avoidCoolTime > 20)
            {
                alpha     = 1;
                AvoidFlag = false;
            }
        }
Exemplo n.º 4
0
 public override void Update(GameTime gameTime)
 {
     motion.Update(gameTime);
     if (motion.IsEnd())
     {
         isDead = true;
     }
 }
Exemplo n.º 5
0
        public override void Update(GameTime gameTime)
        {
            //キー入力の移動量を取得
            Vector2 velocity = Input.Velocity();

            //移動処理
            float speed = 10.0f;

            position = position + Input.Velocity() * speed;

            if (position.X < 0.0f)
            {
                position.X = 0.0f;
            }
            if (position.X >= Screen.Width - 64)
            {
                position.X = Screen.Width - 64;
            }
            if (position.Y < Screen.Null)
            {
                position.Y = Screen.Null;
            }
            if (position.Y >= Screen.Height - 64)
            {
                position.Y = Screen.Height - 64;
            }

            //当たり判定
            var min = Vector2.Zero;
            var max = new Vector2(Screen.Width - 64, Screen.Height - 64);

            position = Vector2.Clamp(position, min, max);

            UpdateMotion();
            motion.Update(gameTime);

            if (Input.GetKeyTrigger(Keys.Space))
            {
                //上下左右キーが押されていなければその向きに移動量を決定
                if (velocity.Length() <= 0)
                {
                    Dictionary <Direction, Vector2> velocityDict = new Dictionary <Direction, Vector2>()
                    {
                        { Direction.LEFT, new Vector2(-1, 0) },
                        { Direction.RIHT, new Vector2(1, 0) },
                        { Direction.UO, new Vector2(0, -1) },
                        { Direction.DOWN, new Vector2(0, 1) },
                    };
                    velocity = velocityDict[direction];
                }
                mediator.AddActor(
                    new PlayerBullet(
                        position,
                        mediator,
                        velocity
                        ));
            }
        }
Exemplo n.º 6
0
 void Update()
 {
     if (!IsInitialized)
     {
         return;
     }
     Fsm?.Update();
     Motion?.Update();
 }
Exemplo n.º 7
0
 public void Update(GameTime gameTime)
 {
     sound.PlayBGM("titlebgm");
     motion.Update(gameTime);
     if (Input.GetKeyTrigger(Keys.Space))
     {
         isEndFlag = true;
         sound.PlaySE("titlese");
     }
 }
Exemplo n.º 8
0
 protected override void AdjustMotion(IMoveable movingObject, InterpolatedVector motion)
 {
     if (!Motion.Active)
     {
         Brake.Update(movingObject, motion);
     }
     else
     {
         Motion.Update(movingObject, motion);
     }
 }
Exemplo n.º 9
0
        public override void Update(GameTime gameTime)
        {
            motion.Update(gameTime);
            timer.Update(gameTime);

            if (timer.IsTime())
            {
                isDeadFlag = true;
                timer.Initialize();
            }
        }
Exemplo n.º 10
0
        public void Update(GameTime gameTime)
        {
            gameDevice.Sound.PlayBGM("Remotest-Liblary_SE");
            motion.Update(gameTime);
            fog.Update(1.0f);

            if (input.IsLeftClick() && !endFlag)
            {
                sound.PlaySE("press");
                endFlag = true;
            }
        }
Exemplo n.º 11
0
 public override void Update(GameTime gameTime)
 {
     if (invinsibleTimer.IsTime())
     {
         NormalUpdate(gameTime);
     }
     else
     {
         InvinsibleUpdate(gameTime);
     }
     motion.Update(gameTime);
     deadPattern.Update(gameTime);
 }
Exemplo n.º 12
0
        public override void Update(GameTime gameTime)
        {
            motion.Update(gameTime);

            if (isMessage)
            {
                timer.Update(gameTime);
            }
            if (timer.IsTime())
            {
                isMessage = false;
                timer.Initialize();
            }
        }
Exemplo n.º 13
0
        public override void Update(GameTime gameTime)
        {
            motion.Update(gameTime);
            if (!stop)
            {
                if (reset)
                {
                    SetRadian((float)Math.Atan2(position2.Y - GetPosition().Y,
                                                position2.X - GetPosition().X) + MathHelper.Pi);
                    SetPos(position2);
                    reset = false;
                }
                radian    += addRadian;
                position.X = r * (float)Math.Cos(radian) + Pos.X;
                position.Y = r * (float)Math.Sin(radian) + Pos.Y;
                prevRadian = radian;

                var rnd = GameDevice.Instance().GetRandom();
                int x   = rnd.Next((int)GetPosition().X + 40, (int)GetPosition().X + 50);
                int y   = rnd.Next((int)GetPosition().Y + 40, (int)GetPosition().Y + 50);
                particleManager.Playerparticle("player2particle", new Vector2(x, y), 1f, 0.5f, 0.5f, 100, 1);
                particleManager.Playerparticle("player2particle", new Vector2(x, y), 1f, 0.5f, 0.5f, 100, 1);
            }
            if (StageState.isMusic)
            {
                if (prevRadian >= 6.3f)
                {
                    //isDeadFlag = true;
                }
            }
            if (StageState.isDead)
            {
                isDeadFlag        = true;
                StageState.isDead = false;
            }

            if (Input.GetKeyTrigger(Keys.Space))
            {
                System.Console.WriteLine(_hit);
            }

            if (Input.GetKeyState(Keys.Enter))
            {
                radian -= 0.095f;
            }
            float delta = (float)gameTime.ElapsedGameTime.TotalSeconds;

            particleManager.Update(delta);
        }
Exemplo n.º 14
0
        public void Update(GameTime gameTime)
        {
            motion.Update(gameTime);
            sound.PlayBGM("TitleBGM");
            if (Input.GetKeyTrigger(Keys.Space) || Input.GetKeyTrigger(PlayerIndex.One, Buttons.A))
            {
                //sound.PlaySE("TitleBGM");
                isEndFrag = true;
                nextScene = Scene.Stage1;
            }

            if (Input.GetKeyTrigger(Keys.T))
            {
                nextScene = Scene.TutorialStage;
                isEndFrag = true;
            }
        }
Exemplo n.º 15
0
        ///更新処理
        ///<param name="gameTime">ゲームの時間</param>
        public override void Update(GameTime gameTime)
        {
            //移動量
            //移動処理
            float sped = 15.0f;

            position = position + Input.Velocity() * sped;
            Vector2 velocity = Vector2.Zero;

            //当たり判定(衝突判定処理)
            UpdateMotion();
            motion.Update(gameTime);

            var min = Vector2.Zero;
            var max = new Vector2(Screen.Width - 64, Screen.Height - 64);

            position = Vector2.Clamp(position, min, max);
        }
Exemplo n.º 16
0
        /// <summary>
        /// モデルに適用するパラメータを計算する。
        /// </summary>
        /// <param name="elapsed_time">経過時間[秒]</param>
        /// <param name="event_data">イベント</param>
        internal bool Update(double elapsed_time, out string[] event_data)
        {
            if (Finished == true)
            {
                event_data = null;
                return(false);
            }

            // モーションのパラメータを計算する
            Motion.Update(Time, LoopEnabled);
            event_data   = Motion.GetFiredEvent(Time, PreviousTime, LoopEnabled);
            PreviousTime = Time;
            Time        += elapsed_time * UserSpeed * SystemSpeed;

            // モーションの終了判定をする
            if (LoopEnabled == false)
            {
                if (Motion.Duration <= Time)
                {
                    Finish();
                }
            }

            // 強制終了中の場合はフェードアウト処理を行う
            if (State == StateType.Terminated)
            {
                if (0.0 < TerminatingDuration)
                {
                    SystemWeight = 1.0 - CubismMath.EaseSine(TerminatingElapsed / TerminatingDuration);
                }
                else
                {
                    SystemWeight = 0.0;
                }
                TerminatingElapsed += elapsed_time;
                if (TerminatingDuration <= TerminatingElapsed)
                {
                    Finish();
                }
            }

            return(true);
        }
Exemplo n.º 17
0
        public override void Update(GameTime gameTime)
        {
            stepTimer.Update(gameTime);
            float speed = 5.0f;

            if (stepVelocity == Input.Velocity() && stepRelease == true && stepTimer.IsTime() == false)
            {
                speed = 100;
            }

            position = position + Input.Velocity() * speed;
            Vector2 vector = new Vector2(Screen.Width / 2, Screen.Height / 2);
            float   length = (position - vector).Length();

            if (Screen.Radius - 16 < length && position.Y > 85.0f)
            {
                position = position - Input.Velocity() * speed;
            }

            else if (position.Y <= 85.0f)
            {
                position.X = MathHelper.Clamp(position.X, Screen.Width / 2 - 250 / 2, Screen.Width / 2 + 250 / 2);
            }
            else if (Input.Velocity().X == 0 && Input.Velocity().Y == 0)
            {
                position.Y += 0.5f;
            }

            if (Input.Velocity() == new Vector2(0, 0))
            {
                stepRelease = true;
            }
            else
            {
                stepVelocity = Input.Velocity();
                stepRelease  = false;
                stepTimer.Initialize();
            }
            UpdateMotion();
            motion.Update(gameTime);
        }
Exemplo n.º 18
0
        public override void Update(GameTime gameTime)
        {
            player = mediator.GetPlayer();
            if (player != null)
            {
                Vector2 playerPos = player.GetPosition();
            }
            IsRidOn();
            FallStart();
            JumpUpdate();
            MoveUpdate();
            IsGoal();
            UpdateMotion();
            motion.Update(gameTime);
            IsTrap();

            Ride();


            if (position.Y >= Screen.Height)
            {
                isDeadFlag = true;
            }
        }
Exemplo n.º 19
0
        ///<summary>
        ///更新処理
        /// </summary>
        /// <param name="gameTime">ゲーム時間</param>
        public override void Update(GameTime gameTime)
        {
            Vector2 velocity = Input.Velocity();

            float speed = 5.0f;

            position = position + Input.Velocity() * speed;

            var min = Vector2.Zero;
            var max = new Vector2(Screen.Width - 64, Screen.Height - 64);

            position = Vector2.Clamp(position, min, max);

            UpdateMotion();
            motion.Update(gameTime);

            if (Input.GetKeyTrigger(Keys.Z))
            {
                if ((velocity.Length()) <= 0)
                {
                    Dictionary <Direction, Vector2> velocityDict = new Dictionary <Direction, Vector2>()
                    {
                        { Direction.LEFT, new Vector2(-1, 0) },
                        { Direction.RIGHT, new Vector2(1, 0) },
                        { Direction.UP, new Vector2(0, -1) },
                        { Direction.DOWN, new Vector2(0, 1) },
                    };
                    velocity = velocity = velocityDict[direction];
                }
                mediator.AddActor(
                    new PlayerBullet(
                        position,
                        mediator,
                        velocity));
            }
        }
Exemplo n.º 20
0
        private void UpdateMotion(GameTime gameTime)
        {
            //キー入力の状態を取得
            Vector2 velocity = Input.Velocity();

            //DeviceのInputでのUpdateVelocityのキーボード入力を変更

            //キー入力がなければなにもしない
            if (velocity.Length() <= 0.0f)
            {
                return;
            }

            //キー入力があった時
            //下向きに変更
            if ((velocity.Y > 0.0f) && (direction != Direction.DOWN))
            {
                ChangeMotion(Direction.DOWN);
            }
            //上向き
            if ((velocity.Y < 0.0f) && (direction != Direction.UP))
            {
                ChangeMotion(Direction.UP);
            }
            //右
            if ((velocity.X > 0.0f) && (direction != Direction.RIGHT))
            {
                ChangeMotion(Direction.RIGHT);
            }
            //左
            if ((velocity.X < 0.0f) && (direction != Direction.LEFT))
            {
                ChangeMotion(Direction.LEFT);
            }
            motion.Update(gameTime);
        }
Exemplo n.º 21
0
        public override void Update()
        {
            base.Update();

            Motion.Update();
        }
Exemplo n.º 22
0
        public void Update(GameTime gameTime)
        {
            motion.Update(gameTime);
            metoronome.Update(gameTime);
            map.Update(gameTime);
            sound.PlayBGM("Title");
            gameObjectManager.Update(gameTime);

            float delta = (float)gameTime.ElapsedGameTime.TotalSeconds;

            particleManager.Update(delta);
            if (particleManager.IsCount(30))
            {
                particleManager.TitleParticle("title", new Vector2(Screen.Width / 2, 200));
            }

            if (player3.IsHit())
            {
                if (!player3.IsStop())
                {
                    player3.SetPosition2(player4.GetPosition());
                    //if (player3.IsPush())
                    //{
                    //    stop4 = false;
                    //    player4.stop = stop4;
                    //}
                }
                else
                {
                    player3.SetPosition2(player4.GetPosition());
                }
            }
            if (player4.IsHit())
            {
                if (!player4.IsStop())
                {
                    player4.SetPosition2(player3.GetPosition());
                    //if (player4.IsPush())
                    //{
                    //    stop3 = false;
                    //    player3.stop = stop3;
                    //}
                }
                else
                {
                    player4.SetPosition2(player3.GetPosition());
                }
            }

            if (!player3.IsStop() && !player4.IsStop())
            {
                player3.SetPosition(new Vector2(128 * 6 + 15, 128 * 5 + 15));
                player4.SetPosition(new Vector2(128 * 7 + 18, 128 * 5 + 18));
                player4.stop = true;
                player3.stop = false;
            }

            if (Input.GetKeyState(Keys.Right))
            {
                camera.Move(1, 0);
            }
            if (Input.GetKeyState(Keys.Left))
            {
                camera.Move(-1, 0);
            }
            if (Input.GetKeyState(Keys.Up))
            {
                camera.Move(0, -1);
            }
            if (Input.GetKeyState(Keys.Down))
            {
                camera.Move(0, 1);
            }
            if (player3.IsDead() || player4.IsDead())
            {
                isEndFlag = true;
            }
        }
Exemplo n.º 23
0
 public void Update() => Motion?.Update();
Exemplo n.º 24
0
 public void Update()
 {
     Motion.Update();
     Move();
 }
Exemplo n.º 25
0
        public void Update(GameTime gameTime)
        {
            map2.Update(gameTime);
            gameObjectManager.Update(gameTime);
            float delta = (float)gameTime.ElapsedGameTime.TotalSeconds;

            particlemanager.Update(delta);

            if (Input.GetKeyTrigger(Keys.M) || StageState.isClear)
            {
                cameraDirection = CameraDirection.IDLE;
                if (!isp)
                {
                    ChangeMotion2(ClearMotion.CLEAR);
                    particlemanager.RightCraccar("star", new Vector2(Screen.Width / 2 - 900, 1000), 0.1f, 1, 500, 10000);
                    particlemanager.LeftCraccar("star", new Vector2(Screen.Width / 2 + 900, 1000), 0.1f, 1, 500, 10000);
                    isp = true;
                }

                cnt++;
                if (cnt > 120)
                {
                    sound.StopBGM();

                    isEndFlag = true;
                }
            }

            if (player.IsHit())
            {
                if (player.IsStop())
                {
                    player.SetPosition2(player2.GetPosition());
                }
                else
                {
                    player.SetPosition2(player2.GetPosition());
                }
            }
            if (player2.IsHit())
            {
                if (player2.IsStop())
                {
                    player2.SetPosition2(player.GetPosition());
                }
                else
                {
                    player2.SetPosition2(player.GetPosition());
                }
            }

            if ((!player.IsStop() && !player2.IsStop() && !StageState.isClear) || _end)
            {
                cameraDirection = CameraDirection.IDLE;
                alpha          += 0.05f;
                if (alpha >= 0.5f)
                {
                    alpha = 0.5f;
                }
                sound.StopBGM();
                cnt++;
                StageState.isMusic = false;
                if (cnt >= 120)
                {
                    isEndFlag = true;
                }
            }

            if (!playNow && Input.GetKeyTrigger(Keys.Space))
            {
                isstart = true;
                ChangeMotion(StartMotion.START);
            }

            if (isstart)
            {
                metoronome.CountUpdate();
                player.stop  = false;
                playNow      = true;
                player.alpha = 1;
                sound.PlayBGM(StageState.worldsStage + "-" + StageState.stageStage);


                if (metoronome.IsCount(4))
                {
                    ChangeMotion(StartMotion.NULL);
                    StageState.isMusic = true;
                    isstart            = false;
                    startcnt           = 0;
                }
            }
            motion.Update(gameTime);
            motion2.Update(gameTime);


            if (StageState.isMusic)
            {
                if (!_end && !safe && !StageState.isClear)
                {
                    end++;
                    if (Input.GetKeyTrigger(Keys.Space))
                    {
                        end = 0;
                    }
                    if (bpm == 120)
                    {
                        if (end == 60)
                        {
                            _end = true;
                        }
                    }
                    else if (bpm == 150)
                    {
                        if (end == 48)
                        {
                            _end = true;
                        }
                    }
                }

                CameraMove(3);
            }

            if (StageState.stageStage == 5)
            {
                if (particlemanager.IsCount(60))
                {
                    var rnd = GameDevice.Instance().GetRandom();
                    switch (StageState.worldsStage)
                    {
                    case 1:
                        int namenumber = rnd.Next(30);
                        if (namenumber % 3 == 0)
                        {
                            namenumber = 1;
                        }
                        else
                        {
                            namenumber = 2;
                        }
                        if (particlemanager.IsCount(60))
                        {
                            particlemanager.Backparticle("onpu" + namenumber, new Vector2(rnd.Next(1920), rnd.Next(1080)), 0, 0, 1, 0.5f, 1, 0.5f, 2, 2, 3);
                        }
                        break;

                    case 2:
                        particlemanager.Backparticle("star", new Vector2(rnd.Next(1920), rnd.Next(1080)), 0, 0, 2, 0, 0, 0.5f, 30, 5, 1);
                        particlemanager.Backparticle("star", new Vector2(rnd.Next(3960), rnd.Next(600)), 200, 150, 1, 0, 0, 0.5f, 10, 2, 1);
                        break;

                    case 3:
                        namenumber = rnd.Next(50);
                        if (namenumber % 2 == 0)
                        {
                            namenumber = 1;
                        }
                        else
                        {
                            namenumber = 2;
                        }
                        if (particlemanager.IsCount(60))
                        {
                            particlemanager.Backparticle("snow" + namenumber, new Vector2(rnd.Next(1920), -100), 50, 180, 1, 0f, 1, 0.1f, 1, 15, 1);
                        }
                        particlemanager.Backparticle("star", new Vector2(rnd.Next(1920), rnd.Next(1080)), 100, 180, 2, 0, 0, 0.5f, 30, 5, 1);
                        break;
                    }
                }
            }
        }
Exemplo n.º 26
0
        public override void Draw()
        {
            if (motion == null)
            {
                return;
            }

            float   radian    = MathHelper.ToRadians(entity.transform.Angle);
            Vector2 position  = entity.transform.Position;
            Vector2 direction = new Vector2((float)Math.Cos(radian), (float)Math.Sin(radian));

            if (isShaderOn)
            {
                shadeTimer.Update();
                if (shadeTimer.IsTime)
                {
                    effect.Parameters["theMask"].SetValue(ResouceManager.GetTexture("NoneMask"));
                }

                graphicsDevice.RasterizerState = RasterizerState.CullClockwise;
                effect.Parameters["Rate"].SetValue(shadeTimer.Rate());

                Vector2 drawPosition = position + Camera2D.GetOffsetPosition() + Method.RightAngleMove(direction, animSpriteSize.Y / 2);
                Vector3 drawP3       = new Vector3(drawPosition, 0);

                VertexUpdate(drawP3);
                graphicsDevice.SetVertexBuffer(vertexBuffer);
                foreach (EffectPass pass in effect.CurrentTechnique.Passes)
                {
                    pass.Apply();
                    graphicsDevice.DrawUserPrimitives <VertexPositionTexture>(
                        PrimitiveType.TriangleStrip,
                        vertexPositions, 0, 2
                        );
                }

                if (shadeTimer.IsTime)
                {
                    isShaderOn = false;
                }
            }
            else
            {
                motion.Update();
                Renderer_2D.Begin(Camera2D.GetTransform());

                while (entity.transform.Angle < 0)
                {
                    entity.transform.Angle += 360;
                }
                int angle = (int)(entity.transform.Angle / 90);

                Renderer_2D.DrawTexture(
                    nowAnim.AnimName,
                    position + Method.RightAngleMove(direction, animSpriteSize.Y / 2),
                    alpha,
                    motion.DrawingRange(),
                    Vector2.One * size,
                    radian,
                    animSpriteSize / 2,
                    angle % 4 == 0 || angle % 4 == 3
                    );

                Renderer_2D.End();
            }
        }
Exemplo n.º 27
0
 public override void Update(GameTime gameTime)
 {
     motion.Update(gameTime);
 }
 public void Update()
 {
     Motion?.Update();
 }
Exemplo n.º 29
0
        public void Update(GameTime gameTime)
        {
            float delta = (float)gameTime.ElapsedGameTime.TotalSeconds;

            particleManager.Update(delta);
            Tmotion.Update(gameTime);
            Smotion.Update(gameTime);
            Rmotion.Update(gameTime);
            MotionUpdate();
            if (Input.GetKeyState(Keys.Space))
            {
                cnt++;

                if (cnt >= 10)
                {
                    if (particleManager.IsCount(20))
                    {
                        switch (sentakucnt)
                        {
                        case 0:
                            particleManager.Circle2("star", new Vector2(475, 525), 0, 360, 1, 0.1f, 1, 1, 0.1f, 100, 200, Color.Yellow);
                            break;

                        case 1:
                            particleManager.Circle2("star", new Vector2(960, 525), 0, 360, 1, 0.1f, 1, 1, 0.1f, 100, 200, Color.Yellow);
                            break;

                        case 2:
                            particleManager.Circle2("star", new Vector2(1445, 525), 0, 360, 1, 0.1f, 1, 1, 0.1f, 100, 200, Color.Yellow);
                            break;
                        }
                    }
                }

                if (cnt >= 60)
                {
                    switch (sentakucnt)
                    {
                    case 0:
                        if (StageState.isClear)
                        {
                            if (StageState.stageStage == 5)
                            {
                                if (StageState.worldsStage == 3)
                                {
                                    StageState.isClear = false;
                                    nextscene          = Scene.Select1;
                                }
                                else
                                {
                                    StageState.stageStage   = 1;
                                    StageState.worldsStage += 1;
                                }
                            }
                            else
                            {
                                StageState.stageStage += 1;
                            }
                        }

                        nextscene = Scene.GamePlay;
                        sound.PlaySE("kettei");
                        isEndFlag = true;


                        break;

                    case 1:
                        nextscene = Scene.Select1;
                        sound.PlaySE("kettei");
                        isEndFlag = true;
                        break;

                    case 2:
                        nextscene = Scene.Title;
                        sound.PlaySE("kettei");
                        isEndFlag = true;
                        break;
                    }
                    cnt = 0;
                }
            }
            if (Input.IsKeyUp(Keys.Space))
            {
                sound.PlaySE("sentaku");
                sentakucnt += 1;
                cnt         = 0;
            }
            if (sentakucnt > 2)
            {
                sentakucnt = 0;
            }
            if (Input.GetKeyState(Keys.Space))
            {
            }
        }
Exemplo n.º 30
0
        public void Update(GameTime gameTime)
        {
            motion.Update(gameTime);
            motion2.Update(gameTime);

            map2.Update(gameTime);
            StageState.isMusic = true;

            if (player.IsDead())
            {
                StageState.isMusic = false;
                isEndFlag          = true;
            }
            if (player2.IsDead())
            {
                StageState.isMusic = false;
                player._dead       = true;
                isEndFlag          = true;
            }

            if (!player.IsStop() && !player2.IsStop())
            {
                player.SetPosition(new Vector2(96 * 2 + 15, 96 * 6 + 15));
                player2.SetPosition(new Vector2(96 * 1 + 15, 96 * 6 + 15));
                player2.stop = true;
                player.stop  = false;
                player.SetPos(new Vector2(96 * 1 + 15, 96 * 6 + 15));
            }

            gameObjectManager.Update(gameTime);
            if (player.IsHit())
            {
                if (!player.IsStop())
                {
                    player.SetPosition2(player2.GetPosition());
                }
                else
                {
                    player.SetPosition2(player2.GetPosition());
                }
            }
            if (player2.IsHit())
            {
                if (!player2.IsStop())
                {
                    player2.SetPosition2(player.GetPosition());
                }
                else
                {
                    player2.SetPosition2(player.GetPosition());
                }
            }
            if (Input.GetKeyTrigger(Keys.D1))
            {
                isEndFlag = true;
            }

            if (player.IsStop())//もしプレイヤーが止まってたら
            {
                if (cameraPos.X < player.GetPosition().X)
                {
                    cameraDirection = CameraDirection.RIGHT;
                }
                if (cameraPos.X > player.GetPosition().X)
                {
                    cameraDirection = CameraDirection.LEFT;
                }
                if (cameraPos.Y < player.GetPosition().Y)
                {
                    cameraDirection = CameraDirection.UP;
                }
                if (cameraPos.Y > player.GetPosition().Y)
                {
                    cameraDirection = CameraDirection.DOWN;
                }

                cameraPos = player.GetPosition();
            }
            if (player2.IsStop())//もしプレイヤーが止まってたら
            {
                if (cameraPos.X < player2.GetPosition().X)
                {
                    cameraDirection = CameraDirection.RIGHT;
                }
                if (cameraPos.X > player2.GetPosition().X)
                {
                    cameraDirection = CameraDirection.LEFT;
                }
                if (cameraPos.Y < player2.GetPosition().Y)
                {
                    cameraDirection = CameraDirection.UP;
                }
                if (cameraPos.Y > player2.GetPosition().Y)
                {
                    cameraDirection = CameraDirection.DOWN;
                }

                cameraPos = player2.GetPosition();
            }
        }