Beispiel #1
0
        private IEnumerator LoadLevel(string songPath, string beatMapPath)
        {
            Loading = true;

            StageMusic.Main.Stop();

            RemoveAllNotes(NoteState.None);
            StageScore.Close();

            HoldOn.Show();
            HoldOn.SetProgress(0f / 2f);

            // Load Music
            yield return(LoadSong(songPath));

            HoldOn.SetProgress(1f / 2f);

            // Load Beat Map
            yield return(LoadBeatMap(beatMapPath));

            HoldOn.SetProgress(2f / 2f);

            HoldOn.Hide();
            Resources.UnloadUnusedAssets();

            TheStageSetting.AutoPlay = TheStageSetting.AutoPlayIsOn;

            GamePlaying = true;

            yield return(new WaitForSeconds(0.5f));

            RemoveAllNotes();
            yield return(new WaitForSeconds(0.5f));


            // Ready -- Go --

            StageMusic.Main.Play();
            StageMicrophone.MicrophoneStart(Mathf.CeilToInt(StageMusic.Main.Length));

            Loading = false;
            yield return(null);
        }
Beispiel #2
0
 public static void StopGame()
 {
     if (Loading || !Main)
     {
         return;
     }
     StageMusic.Main.Clear();
     StageMicrophone.MicrophoneStop();
     BeatMapManager.ClearBeatMap();
     GamePlaying = false;
     TheStageSetting.TitleBGM.UnPause();
     TheStageSetting.AutoPlayTagOn  = TheStageSetting.AutoPlay;
     TheStageSetting.ResultScore    = 0;
     TheStageSetting.ResultPerfect  = StageScore.PerfectNum;
     TheStageSetting.ResultGood     = StageScore.GoodNum;
     TheStageSetting.ResultMiss     = StageScore.MissNum;
     TheStageSetting.ResultMaxCombo = StageScore.MaxCombo;
     InitAimTransform();
     RemoveAllNotes();
     TheStageSetting.AutoPlay = true;
     StageScore.Close();
 }
Beispiel #3
0
 void Awake()
 {
     Main = this;
 }
Beispiel #4
0
        void Update()
        {
            step++;
            ///*
            if (GamePlaying && StageMicrophone.IsReady)
            {
                float[] f = StageMicrophone.GetData(StageMicrophone.SamplePosition() - StageMicrophone.sampleRate, StageMicrophone.sampleRate);
                for (int i = 0; i < f.Length - 1; i++)
                {
                    Debug.DrawLine(
                        new Vector3((float)(i - 1), f[i] * 10000f, 0f),
                        new Vector3((float)i, f[i + 1] * 10000f, 0f),
                        Color.red
                        );
                }
                StageMicrophone.Main.Source.time = Mathf.Max(((float)StageMicrophone.SamplePosition() / StageMicrophone.sampleRate) - 0.02f, 0f);
            }
            //*/



            // Ani

            TheStageSetting.MenuAni.SetBool("GamePlaying", GamePlaying);
            TheStageSetting.MainBtnAni.SetBool("SignedIn", IsSignedIn);

            // Menu Random Note

            if (!GamePlaying)
            {
                RandomAddNote(
                    Time + TheStageSetting.ShowNoteTime,
                    0, 24, 0, 6, 0f, 0.9f
                    );
//				if (step >= 200){
//					step = 0;
//					Stage.AddNote(new NoteInfo(
//						7,
//						6,
//						Time + TheStageSetting.ShowNoteTime,
//						0, 7
//					));
//				}
            }

            // Aim Movement

            int cameraID = (int)TheStageSetting.TrackID(TheStageSetting.CameraPos).x;

            for (int i = 0; i < TheStageSetting.FretSigns.Length; i++)
            {
                TheStageSetting.FretSigns[i].color = Color.Lerp(
                    TheStageSetting.FretSigns[i].color,
                    GamePlaying && Mathf.Abs(cameraID - i) < 4 ? TheStageSetting.FretSignColor : Color.clear,
                    0.1f
                    );
            }

            ShowingScore = StageScore.CurrentScore >= StageScore.FullScore ?
                           (int)StageScore.FullScore :
                           (int)Mathf.Lerp(
                ShowingScore,
                (GamePlaying ? StageScore.CurrentScore : 0),
                0.9f
                );
            TheStageSetting.ScoreTXT = ShowingScore;

            TheStageSetting.TitleBGM.volume = Mathf.Lerp(
                TheStageSetting.TitleBGM.volume,
                GamePlaying ? 0f: 1f,
                0.02f
                );

            if (GamePlaying && TheStageSetting.TitleBGM.volume < 0.01f)
            {
                TheStageSetting.TitleBGM.Pause();
            }

            TheStageSetting.TrackBackSR.color = Color.Lerp(
                TheStageSetting.TrackBackSR.color,
                GamePlaying ? TheStageSetting.TrackBackColor : Color.clear,
                0.01f
                );

            TheStageSetting.GuitarBody.color = TheStageSetting.GuitarHead.color = Color.Lerp(
                TheStageSetting.GuitarBody.color,
                GamePlaying ? Color.clear : TheStageSetting.GuitarColor,
                0.01f
                );

            TheStageSetting.MainCamera.localPosition = Vector3.Lerp(
                TheStageSetting.MainCamera.localPosition,
                GamePlaying ? TheStageSetting.CameraPlayingPos : TheStageSetting.CameraMenuPos,
                0.16f
                );

            TheStageSetting.MainCamera.localRotation = Quaternion.Lerp(
                TheStageSetting.MainCamera.localRotation,
                GamePlaying ? TheStageSetting.CameraPlayingRot : TheStageSetting.CameraMenuRot,
                0.16f
                );

            TheStageSetting.CameraPos = Vector3.Lerp(TheStageSetting.CameraPos, CameraAimPos, CameraMoveRant);
            TheStageSetting.CameraRot = Quaternion.Lerp(TheStageSetting.CameraRot, CameraAimRot, CameraRotRant);

            for (int i = 0; i < 6; i++)
            {
                TheStageSetting.Strings[i].color      = Color.Lerp(TheStageSetting.Strings[i].color, StringAimColors[i], StringColorRant);
                TheStageSetting.StringLights[i].color = Color.Lerp(TheStageSetting.Strings[i].color, StringAimColors[i], StringColorRant);
            }

            for (int i = 0; i < 24; i++)
            {
                TheStageSetting.TrackHighLights[i].color = Color.Lerp(TheStageSetting.TrackHighLights[i].color, TrackHightLightAimColors[i], TrackHightLightColorRant);
            }

            for (int i = 0; i < 6; i++)
            {
                Vector3 pos = StringAimPos[i] + (StringAimPos[i] - TheStageSetting.StringTFs[i].position) * StringShackRant;
                TheStageSetting.StringTFs[i].position = pos;
            }

            for (int i = 0; i < 25; i++)
            {
                TheStageSetting.FretWireLights[i].color = Color.Lerp(TheStageSetting.FretWireLights[i].color, FretWireLightAimColors[i], FretWireLightColorRant);
            }

            // Msg
            InputManager.StageUpdate();
        }