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"); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); ScriptableUnitTiers _target = target as ScriptableUnitTiers; List <IUnlockable> all_unlockables = new List <IUnlockable>(); List <Unlockable <SquadSizeConfig> > squadsizes = UnlockableFactory.MakeUnlockables(_target.SquadSizes, null, SquadSizeConfig.GetRequirement, SquadSizeConfig.GetID); List <Unlockable <UnitTier> > units = UnlockableFactory.MakeUnlockables(TieredUnit.AllTiers(_target.TieredUnitsSelectible), null, UnitTier.GetRequirement, UnitTier.GetID); all_unlockables.AddRange(units.Select(tier => tier as IUnlockable).ToList()); all_unlockables.AddRange(squadsizes.Select(size => size as IUnlockable).ToList()); all_unlockables = all_unlockables.OrderBy(unlockable => unlockable.GetLevelRequirement()).ToList(); all_unlockables.ForEach(unlockable => EditorGUILayout.LabelField(unlockable.GetLevelRequirement() + " - " + unlockable.GetID())); }
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"); }
public SquadManager(List <TieredUnit> Tiers, List <SquadSizeConfig> SquadSizes, Levels levels, bool DEBUG_RANDOM_GROUP = false) { _instance = this; DebugUseForceSelected = DEBUG_RANDOM_GROUP; squadsizeunlocks = UnlockableFactory.MakeUnlockables <SquadSizeConfig>(SquadSizes, levels, SquadSizeConfig.GetRequirement, SquadSizeConfig.GetID); unitunlocks = UnlockableFactory.MakeUnlockables <TieredUnit>(Tiers, levels, TieredUnit.GetRequirement, TieredUnit.GetID); evacuated = new List <ScriptableUnitConfig>(); killed = new List <ScriptableUnitConfig>(); if (!DebugUseForceSelected) { Reset(); } else { selected_units = new List <TieredUnit>(Tiers).GetRandomRemove(GetMaxSquadsize()); OnSelectedUpdate.AttemptCall(selected_units); } Unit.OnEvacuated += Evacuated; Unit.OnUnitKilled += Killed; }