Exemple #1
0
        internal string Pattern()
        {
            int difficulty = quaver.init.select.difficulty;

            string[] sequences = new string[difficulty == 3 ? 1 : difficulty + 1];

            for (int i = 0; i < sequences.Length; i++)
            {
                for (int j = 0; j < length; j++)
                {
                    sequences[i] += patterns[difficulty][Rnd.Range(0, patterns[difficulty].Length)];
                }
            }

            string finalSequence = string.Empty;

            for (int i = 0; i < sequences[0].Length; i++)
            {
                int sum = 0;
                for (int j = 0; j < sequences.Length; j++)
                {
                    sum += QE.CharToInt(sequences[j][i]);
                }

                finalSequence += sum.ToString();
            }

            return(finalSequence);
        }
Exemple #2
0
        internal IEnumerator Play(RenderScript render)
        {
            Debug.LogFormat("[Quaver #{0}]: Difficulty settings are [{1}, {2}, {3}].", quaver.init.moduleId, quaver.init.select.speed > 9 ? "2.0" : "1." + quaver.init.select.speed, new[] { "Normal", "Hard", "Insane", "Expert" }[quaver.init.select.difficulty], quaver.init.select.perColumn);
            quaver.Audio.PlaySoundAtTransform(Sounds.Q.Start, quaver.transform);

            int difficulty = quaver.init.select.difficulty;
            int speed      = quaver.init.select.speed;

            amplifier = difficulty == 3 ? 5 : 1;
            length    = difficulty == 3 ? 20 : 8;

            sequence = Pattern();

            yield return(quaver.Render.Transition());

            yield return(new WaitWhile(() => sequence == string.Empty));

            for (int i = 0; i < sequence.Length; i++)
            {
                if (QE.CharToInt(sequence[i]) == 0)
                {
                    ArrowScript.positionsUsed = new int[4];
                }

                for (int j = 0; j < QE.CharToInt(sequence[i]); j++)
                {
                    render.CreateArrow(QE.CharToInt(sequence[i]), IndexToColor(i));
                }

                render.songProgress = (float)i / sequence.Length;

                /// EDIT
                yield return(new WaitForSecondsRealtime(1 / (GetSpeed(speed, difficulty == 3) * amplifier)));
            }

            render.songProgress = 1;

            if (quaver.init.select.perColumn)
            {
                foreach (var text in quaver.ReceptorTexts)
                {
                    text.text = "0";
                }
            }
            else
            {
                quaver.Render.UpdateReceptorTotalText(0);
            }

            yield return(new WaitForSecondsRealtime(1));

            quaver.init.ready = true;
            Debug.LogFormat("[Quaver #{0}]: The current solution is {1}.", quaver.init.moduleId, quaver.init.select.perColumn ? ArrowScript.arrowsPerColumn.Join(", ") : ArrowScript.arrowsPerColumn.Sum().ToString());
        }