private void checkKill()
    {
        if (isEnd || isDemoPlay)
        {
            return;
        }

        // Escapeを長押ししたときは強制終了させる
        if (Input.GetButton("Cancel"))
        {
            pushExitCount += Time.deltaTime;

            if (pushExitCount >= 1.0f)
            {
                Kill();
            }
        }
        else
        {
            pushExitCount = 0;
        }

        RuleStruct playingRule = gaugeStructs.gaugeRules[gaugeRule];

        if (playingRule.death)
        {
            if (uiData.gaugePer <= 0)
            {
                Kill();
            }
        }
    }
Exemple #2
0
    public void ChangeGauge()
    {
        RuleStruct rule = gaugeRule.gaugeRules[(int)gauge];

        nonClearGauge.color      = rule.nonClearColor;
        clearGauge.color         = rule.clearColor;
        nonClearGauge.fillAmount = rule.clearPar;

        valueNameText.SetText(Enum.GetName(typeof(GaugeRule), gauge));
    }
Exemple #3
0
    private void InitGauge(RuleStruct gaugeRule)
    {
        clearGauge.color     = gaugeRule.clearColor;
        nonClearGauge.color  = gaugeRule.nonClearColor;
        clearBackGauge.color = gaugeRule.quoteColor;

        clearBackGauge.fillAmount = 1 - gaugeRule.clearPar;

        SetGauge(gaugeRule.startPar, gaugeRule.clearPar);
    }
    private ClearType JudgeClearType()
    {
        if (isDeath)
        {
            return(ClearType.Failed);
        }

        ClearType clearType;

        if (notesController.totalCombo == uiData.conboCount)
        {
            if (uiData.judgeCount[(int)JudgeType.Just] == notesController.totalCombo)
            {
                clearType = ClearType.Prefect;
            }
            else
            {
                clearType = ClearType.FullCombo;
            }
        }
        else
        {
            RuleStruct selectedRule = gaugeStructs.gaugeRules[gaugeRule];

            if (uiData.gaugePer >= selectedRule.clearPar)
            {
                if ((int)StaticValue.gaugeRule == (int)GaugeRule.Expert)
                {
                    clearType = ClearType.ExClear;
                }
                else
                {
                    clearType = ClearType.Clear;
                }
            }
            else
            {
                clearType = ClearType.Failed;
            }
        }

        return(clearType);
    }
Exemple #5
0
    public IEnumerator GenerateNotes(RuleStruct gaugeRule, ChartStruct chart, GameObject[] laneObjs)
    {
        Array.Resize(ref notes, laneObjs.Length);

        int[] laneNoteCount = new int[notes.Length];

        for (int i = 0; i < notes.Length; i++)
        {
            Array.Resize(ref notes[i], 1);
            laneNoteCount[i] = 0;
        }

        float nextFlameTime = Clac.NextFlameTime();
        int   notesCount    = 0;

        foreach (NotesStruct note in chart.notes)
        {
            // 処理時間がフレームレートの80%を超えたら次のフレームへ
            if (Time.realtimeSinceStartup >= nextFlameTime)
            {
                yield return(null);

                nextFlameTime = Clac.NextFlameTime();
            }

            int lane = note.lane - 1;

            Transform   noteObj       = GenerateNote(note.type, note.lane, laneObjs).transform;
            NormalNotes generateNotes = noteObj.GetComponent <NormalNotes>();
            // 光るノーツならマテリアルを変える
            Material noteMaterial = note.shiny ? shinyMaterial : null;
            generateNotes.Init(note, chart, noteMaterial);

            _totalCombo      += generateNotes.ClacComboCount();
            _totalGaugeCount += generateNotes.ClacGaugeCount(gaugeRule);

            Array.Resize(ref notes[lane], laneNoteCount[lane] + 1);
            notes[lane][laneNoteCount[lane]] = generateNotes;

            laneNoteCount[lane]++;
            notesCount++;
        }
    }
Exemple #6
0
    public void Init(UIDataStruct uiData, RuleStruct gaugeRule, int trackCount, string musicName, string artistName, Difficulty difficulty, float level, float timeLength, bool isDemo, bool isTutorial)
    {
        SetComboText(0);
        SetMaxConboText(0);

        chartTimeLength = timeLength;

        System.Array.Resize(ref beforeUIData.judgeCount, uiData.judgeCount.Length);

        for (int i = 0; i < uiData.judgeCount.Length; i++)
        {
            SetJudgeCountText(0, i);
        }

        SetBPMText(uiData.bpm, uiData.noteSpeed);

        // 表示が変わらないUIはここで値を代入
        trackText.SetText("Track {0}", trackCount);
        musicText.SetText(musicName);
        artistText.SetText(artistName);
        difficultyText.SetText(difficulty.ToString());
        difficultyText.color = new Color(
            r: difficultyData.difficlties[(int)difficulty].color.r,
            g: difficultyData.difficlties[(int)difficulty].color.g,
            b: difficultyData.difficlties[(int)difficulty].color.b,
            a: difficultyText.color.a
            );
        levelText.SetText("{0:2}", level);

        demoCanvas.enabled = isDemo;
        // 通常のゲームでAutoPlayの場合は、専用テキストを表示させる
        if (!isTutorial && !isDemo && StaticValue.isAuto)
        {
            autoPlayText.gameObject.SetActive(true);
        }

        InitGauge(gaugeRule);
        SetTimeGauge();
    }
Exemple #7
0
    public void UpdateManage(UIDataStruct uiData, RuleStruct gaugeRule, bool isEnd)
    {
        if (uiData.conboCount != beforeUIData.conboCount)
        {
            if (uiData.conboCount < beforeUIData.conboCount)
            {
                //コンボが途切れた場合はグラデーションを切る
                if (comboCountText.enableVertexGradient)
                {
                    comboCountText.enableVertexGradient = false;
                }
            }

            if ((uiData.conboCount / comboAnimCount) != (beforeUIData.conboCount / comboAnimCount) && uiData.conboCount != 0)
            {
                comboAnimText.SetText("{0}", uiData.conboCount / comboAnimCount * comboAnimCount);
                countComboAnim.SetTrigger("Show");
            }

            SetComboText(uiData.conboCount);
        }

        if (uiData.barrageCount != beforeUIData.barrageCount)
        {
            SetBarrageText(uiData.barrageCount);
        }

        if (uiData.maxConbo != beforeUIData.maxConbo)
        {
            SetMaxConboText(uiData.maxConbo);
        }

        for (int i = 0; i < uiData.judgeCount.Length; i++)
        {
            if (uiData.judgeCount[i] != beforeUIData.judgeCount[i])
            {
                SetJudgeCountText(uiData.judgeCount[i], i);
            }
        }

        if (uiData.scoreCount != beforeUIData.scoreCount)
        {
            InitScoreAnim(uiData.maxScoreCount, uiData.scoreCount);
        }

        if (isAnimScore)
        {
            AnimScoreText();
        }

        if ((uiData.bpm != beforeUIData.bpm) || (uiData.noteSpeed != beforeUIData.noteSpeed))
        {
            SetBPMText(uiData.bpm, uiData.noteSpeed);
        }

        if (uiData.gaugePer != beforeUIData.gaugePer)
        {
            SetGauge(uiData.gaugePer, gaugeRule.clearPar);
        }

        SetTimeGauge();

        if (gaugeRule.death)
        {
            if (isEnd)
            {
                parcentageTextAnim.SetBool("Dying", false);
            }
            else if (uiData.gaugePer <= gaugeRule.dyingRate)
            {
                if (!parcentageTextAnim.GetBool("Dying"))
                {
                    parcentageTextAnim.SetBool("Dying", true);
                    growSprite.color = Color.red;
                }
            }
            else
            {
                if (parcentageTextAnim.GetBool("Dying"))
                {
                    parcentageTextAnim.SetBool("Dying", false);
                    growSprite.color = Color.white;
                }
            }
        }

        beforeUIData.SetParam(uiData);
    }
    public override int ClacGaugeCount(RuleStruct gaugeRule)
    {
        int comboCount = ClacComboCount();

        return((int)(gaugeRule.gaugeCount[(int)JudgeType.Just] * gaugeRule.holdParRate * comboCount));
    }
 public virtual int ClacGaugeCount(RuleStruct gaugeRule)
 {
     return(gaugeRule.gaugeCount[(int)JudgeType.Just]);
 }
    public void UpdateManage(ref UIDataStruct uiData, RuleStruct gaugeRule, GameObject[] laneObjs, JudgeData timingRange, bool isStarted)
    {
        int currentFlame = timeCountroller.PlayFlame;
        int deltaFlame   = timeCountroller.DeltaFlame;

        for (int i = 0; i < laneObjs.Length; i++)
        {
            NotesType type        = NotesType.Normal;
            JudgeType judgeResult = JudgeType.None;

            if (isStarted)
            {
                type        = NotesType.Normal;
                judgeResult = Judge(
                    type: ref type,
                    currentFlame: currentFlame,
                    judgeLane: i,
                    deltaFlame: deltaFlame,
                    judgeData: timingRange
                    );

                uiData.barrageCount = targetBarrageCount;
            }

            LaneBeamManage(i);

            if (judgeResult == JudgeType.None)
            {
                continue;
            }

            uiData.judgeCount[(int)judgeResult]++;
            uiData.scoreCount += timingRange.judges[(int)judgeResult].scoreCount;

            float typeRate = 1.0f;
            if (type == NotesType.Hold)
            {
                typeRate = gaugeRule.holdParRate;
            }

            if (judgeResult == JudgeType.Miss)
            {
                float missPenalty = gaugeRule.missPenalty;

                if (gaugeRule.dyingRate >= uiData.gaugePer)
                {
                    missPenalty /= 2;
                }

                uiData.conboCount = 0;
                uiData.gaugePer   = Mathf.Clamp01(uiData.gaugePer - missPenalty * typeRate / 100);
            }
            else
            {
                float addPer = gaugeRule.gaugeCount[(int)judgeResult] / (float)uiData.totalGaugeCount * gaugeRule.parRate * typeRate;
                uiData.gaugePer = Mathf.Clamp01(uiData.gaugePer + addPer);

                uiData.conboCount++;
                judgeLineAnim.SetTrigger("Shiny");

                if (uiData.maxConbo < uiData.conboCount)
                {
                    uiData.maxConbo = uiData.conboCount;
                }
            }
        }

        judgeLineMaterial.SetFloat("_Shiny", judgeLineShiny);
    }