예제 #1
0
    public void OnStageComplete()
    {
        foreach (NoteGrade grade in Enum.GetValues(typeof(NoteGrade)))
        {
            if (grade == NoteGrade.None)
            {
                continue;
            }
            gradeCounts[grade] = Stages.Sum(it => it?.GradeCounts[grade] ?? 0);
        }

        if (Criteria.Any(it => it.Judge(this) == CriterionState.Failed))
        {
            IsFailed = true;
        }
        else if (CurrentStageIndex < Stages.Length - 1)
        {
            // Refill health by 30% of lost health
            var maxHealth = Tier.Meta.maxHealth;
            Health += 0.3 * (maxHealth - Health);
            if (Health > maxHealth)
            {
                Health = maxHealth;
            }
        }

        if (CurrentStageIndex == Stages.Length - 1)
        {
            OnComplete();
        }
    }