final push
This commit is contained in:
@@ -21,7 +21,7 @@ public class TraitSelectorManager : MonoBehaviour
|
||||
[SerializeField]
|
||||
private int _traitThreshold = 7;
|
||||
|
||||
|
||||
[SerializeField] public int _compositionPerFrame = 100;
|
||||
public void ListAllActivableCompo()
|
||||
{
|
||||
var emblemList = _emblemSelector.GetEmblems();
|
||||
@@ -37,16 +37,33 @@ public class TraitSelectorManager : MonoBehaviour
|
||||
var compositions = TraitsMapping.GenerateCombinations(mandatoryChampions, acceptableChampions, compositionSize);
|
||||
Debug.Log($"{compositions.Count} Compositions generated.");
|
||||
yield return 0f;
|
||||
|
||||
int compHandled = 0;
|
||||
int totalCompHandled = 0;
|
||||
int totalSucessfulCompFound = 0;
|
||||
foreach (var composition in compositions)
|
||||
{
|
||||
HandleCombination(composition, emblemList);
|
||||
yield return 0f;
|
||||
int activeSynergies = GetActiveSynergy(composition, emblemList);
|
||||
compHandled++;
|
||||
totalCompHandled++;
|
||||
if(TraitUtils.TraitCountFromInt(activeSynergies) >= _traitThreshold)
|
||||
{
|
||||
totalSucessfulCompFound++;
|
||||
HashSet<ChampionsEnum> champions = ChampionUtils.FromLong(composition);
|
||||
var s = TraitsMapping.CompositionToString(champions);
|
||||
Debug.Log($"{totalSucessfulCompFound}: {s} - {TraitUtils.TraitCountFromInt(activeSynergies)}");
|
||||
}
|
||||
if(compHandled >= _compositionPerFrame)
|
||||
{
|
||||
Debug.LogWarning($"{totalSucessfulCompFound} : {totalCompHandled} Compositions handled.");
|
||||
compHandled = 0;
|
||||
yield return 0f;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Log("Total successful compositions found: " + totalSucessfulCompFound);
|
||||
}
|
||||
|
||||
private void HandleCombination(long combination, Dictionary<int, int> emblemList)
|
||||
private int GetActiveSynergy(long combination, Dictionary<int, int> emblemList)
|
||||
{
|
||||
var synergies = TraitsMapping.TraitCountInCompo(combination);
|
||||
|
||||
@@ -55,16 +72,12 @@ public class TraitSelectorManager : MonoBehaviour
|
||||
emblemList
|
||||
);
|
||||
var activeSynergies = TraitsMapping.FilterActiveTraits(synergiesWithEmblem);
|
||||
return activeSynergies;
|
||||
|
||||
}
|
||||
|
||||
if (TraitUtils.TraitCountFromInt(activeSynergies) >= _traitThreshold)
|
||||
{
|
||||
HashSet<ChampionsEnum> champions = ChampionUtils.FromLong(combination);
|
||||
var s = TraitsMapping.CompositionToString(champions);
|
||||
Debug.Log(s);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// //Debug.LogWarning("Combination not valid");
|
||||
// }
|
||||
public void StopAll()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user