예제 #1
0
 public GameState(GameMode mode, Level level, Difficulty difficulty) : this()
 {
     Mode          = mode;
     Level         = level;
     Difficulty    = difficulty;
     ChartChecksum = SecuredOperations.CalculateChartChecksum(Level, Difficulty);
 }
예제 #2
0
    public GameState(Game game, GameMode mode, HashSet <Mod> mods)
    {
        Level           = game.Level;
        Difficulty      = game.Difficulty;
        DifficultyLevel = Level.Meta.GetDifficultyLevel(Difficulty.Id);
        Mode            = mode;
        Mods            = new HashSet <Mod>(mods);
        ChartChecksum   = SecuredOperations.CalculateChartChecksum(Level, Difficulty);

        NoteCount = game.Chart.Model.note_list.Count;
        game.Chart.Model.note_list.ForEach(it => Judgements[it.id] = new NoteJudgement());
        noteScoreMultiplierFactor = Math.Sqrt(NoteCount) / 3.0;

        UseHealthSystem = Mods.Contains(Mod.Hard) || Mods.Contains(Mod.ExHard) || mode == GameMode.Tier;
        MaxHealth       = DifficultyLevel * 75;
        if (MaxHealth <= 0)
        {
            MaxHealth = 1000;
        }
        Health = MaxHealth;

        switch (mode)
        {
        case GameMode.Tier:
        {
            Context.TierState.Stages[Context.TierState.CurrentStageIndex] = this;
            // Keep allowed mods only
            Mods.IntersectWith(AllowedTierMods);
            if (Application.isEditor && game.EditorForceAutoMod)
            {
                Mods.Add(Mod.Auto);
            }
            // Use max health from meta
            MaxHealth = Context.TierState.Tier.Meta.maxHealth;
            Health    = MaxHealth;
            break;
        }

        case GameMode.Calibration:
            // Remove auto mods
            Mods.ExceptWith(DisallowedCalibrationMods);
            if (Application.isEditor && game.EditorForceAutoMod)
            {
                Mods.Add(Mod.Auto);
            }
            break;
        }
    }
예제 #3
0
 public GameState()
 {
     IsCompleted = true;
     Mods        = new HashSet <Mod>();
     Score       = 1000000;
     Accuracy    = 1.000000;
     MaxCombo    = 1;
     gradeCounts = new Dictionary <NoteGrade, int>
     {
         { NoteGrade.Perfect, 1 },
         { NoteGrade.Great, 0 },
         { NoteGrade.Good, 0 },
         { NoteGrade.Bad, 0 },
         { NoteGrade.Miss, 0 }
     };
     Level         = MockData.CommunityLevel;
     Difficulty    = Difficulty.Parse(Level.Meta.charts[0].type);
     ChartChecksum = SecuredOperations.CalculateChartChecksum(Level, Difficulty);
 }