예제 #1
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;
                    }
                }
            }
        }