Exemplo n.º 1
0
        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
                    }
                }
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 private bool AddTraitSet(CharacterObject character, TraitSet traitSet)
 {
     return(true);
 }