public void RegisterTraitSet(TraitSet set, List <CharacterObject> charactersToGiveTraitTo = null) { if (!AllTraitSets.Contains(set)) { AllTraitSets.Add(set); if (charactersToGiveTraitTo == null) { return; } foreach (var character in charactersToGiveTraitTo) { if (CharacterTraitInfo.TryGetValue(character, out var currentSet)) { if (!currentSet.Contains(set)) { currentSet.Add(set); } } else { //generate a new Character with traits or return that the hero does not exist } } } }
public void GivePlayerTraitSet(TraitSet traitSet) { try { if (!CharacterTraitInfo.TryGetValue(CharacterObject.PlayerCharacter, out var playerTraits)) { Util.LogMessage("Failed to give Player a trait, because I failed to find the list of Player's traits"); return; } if (!playerTraits.Contains(traitSet)) { Util.LogMessage($"The Player does not contain traitSet: {traitSet.ID}, adding to his traitSet list"); traitSet.Init(CharacterObject.PlayerCharacter); playerTraits.Add(traitSet); } Util.LogMessage($"The Player already has the traitSet: {traitSet.ID}, will not be adding"); } catch (Exception e) { Util.LogMessage("Failed to give Player a trait " + e); } }
private bool AddTraitSet(CharacterObject character, TraitSet traitSet) { return(true); }