Exemple #1
0
    public void GoToNextLevel()
    {
        Levels m_levels = new Levels(MockConfig());

        m_levels.AddProgress(1000);
        int nextlevel       = m_levels.GetCurrentLevel() + 1;
        int progress_to_add = (m_levels.GetRequiredForLevel(nextlevel) - m_levels.GetProgress());

        m_levels.AddProgress(progress_to_add);


        Assert.AreEqual(nextlevel, m_levels.GetCurrentLevel(), "LEVEL NOT NEXT LEVEL");
    }
Exemple #2
0
    public void GoToMaxLevel()
    {
        Levels m_levels = new Levels(MockConfig());

        m_levels.AddProgress(m_levels.GetRequiredForLevel(m_levels.GetMaxLevel()));
        Assert.AreEqual(7, m_levels.GetCurrentLevel(), "LEVEL NOT MAX LEVEL");
    }
Exemple #3
0
    public void LevelOnAmountEqual()
    {
        Levels m_levels = new Levels(MockConfig());

        m_levels.AddProgress(200);

        Assert.AreEqual(2, m_levels.GetCurrentLevel(), "NOT LEVEL 2 AFTER GIVING EQUAL AMOUNT TO REQUIREMENT");
    }
Exemple #4
0
    public void TestDelayedLevelUpListener()
    {
        Levels levels = MockLevels();

        levels.AddProgress(0);
        levels.AddProgress(30);
        levels.AddProgress(31);
        levels.AddProgress(100);
        levels.AddProgress(100000000);

        List <Unlockable <BlaConfig> > Unlockables = UnlockableFactory.MakeUnlockables(MockConfigs(), levels, getunlock, getid);

        Unlockables.ForEach(unlock => unlock.AddUnlockListener(OnUnlock));

        bool _all_called = HasAllUnlockedOnce(Unlockables);

        Assert.IsTrue(_all_called, "Not All Configs have been unlocked");
    }
Exemple #5
0
    public void TestLevelUpCallBacks()
    {
        Levels levels = MockLevels();
        List <Unlockable <BlaConfig> > Unlockables = UnlockableFactory.MakeUnlockables(MockConfigs(), levels, getunlock, getid, OnUnlock);

        levels.OnProgress += p => MDebug.Log("PROGRESS " + p + " " + levels.GetProgressInLevel());
        levels.OnLevelUp  += l => MDebug.Log("LEVELUP " + l);

        //GetComponent<UnlockableViewTest>().SetUnlockable(Unlockables.GetRandom());
        levels.AddProgress(0);
        levels.AddProgress(30);
        levels.AddProgress(31);
        levels.AddProgress(100);
        levels.AddProgress(100000000);

        bool _all_called = HasAllUnlockedOnce(Unlockables);

        Assert.IsTrue(_all_called, "Not All Configs have been unlocked");
    }
Exemple #6
0
    public void SquadManagerHigherLevelTest()
    {
        Levels       level            = new Levels(LevelTest.MockConfig());
        SquadManager new_squadmanager = new SquadManager(level);

        int start_squad_size      = new_squadmanager.GetMaxSquadsize();
        int start_selectibe_units = new_squadmanager.GetUnlockedTiers().Count;

        level.AddProgress(10000000);
        Assert.Less(start_selectibe_units, new_squadmanager.GetUnlockedTiers().Count, "DIDNT UNLOCK UNITS");
        Assert.Less(start_squad_size, new_squadmanager.GetMaxSquadsize(), "DIDNT UNLOCK SQUAD SIZE");
    }
Exemple #7
0
    public void LevelSaveTest()
    {
        LevelConfig mockConfig = MockConfigSaved();

        Levels m_levels = new Levels(mockConfig);


        m_levels.AddProgress(100000000);
        int level = m_levels.GetCurrentLevel();

        Levels m_levels_2 = new Levels(mockConfig);


        Assert.AreEqual(level, m_levels_2.GetCurrentLevel(), "SAVED LEVEL NOT NEW LEVEL");
    }