예제 #1
0
        private void PopulateAspects()
        {
            bool attributesPopulated = false;
            bool skillsPopulated     = false;

            if (Archetype != null)
            {
                if (Archetype.AttributeIDs != null)
                {
                    Dictionary <int, float> distributions = new Dictionary <int, float>();

                    for (int i = 0; i < Archetype.AttributeIDs.Count; i++)
                    {
                        if (INE.Char.ValidAspect(Archetype.AttributeIDs[i], AspectType.Attributes))
                        {
                            distributions.Add(Archetype.AttributeIDs[i], 0);
                        }
                    }

                    Attributes          = new INEAspectGroup(distributions, AspectType.Attributes);
                    attributesPopulated = true;
                }

                if (Archetype.SkillIDs != null)
                {
                    Dictionary <int, float> distributions = new Dictionary <int, float>();

                    for (int i = 0; i < Archetype.SkillIDs.Count; i++)
                    {
                        if (INE.Char.ValidAspect(Archetype.SkillIDs[i], AspectType.Skills))
                        {
                            distributions.Add(Archetype.SkillIDs[i], 0);
                        }
                    }

                    Skills          = new INEAspectGroup(distributions, AspectType.Skills);
                    skillsPopulated = true;
                }
            }

            if (!attributesPopulated)
            {
                Attributes = new INEAspectGroup(AspectType.Attributes);
            }

            if (!skillsPopulated)
            {
                Skills = new INEAspectGroup(AspectType.Skills);
            }
        }
예제 #2
0
        //Set Aspects is just to connect UI, it does no other initial value setup other than determining the starting posistion of the target slider
        public void SetAspects(CharacterBuilderUI parent, INEAspectGroup aspectGroup)
        {
            if (parent != null && aspectGroup != null)
            {
                Parent      = parent;
                AspectGroup = aspectGroup;

                AspectsUI = new Dictionary <int, AspectItemUI>();

                foreach (KeyValuePair <int, INEAspect> aspect in AspectGroup.Aspects)
                {
                    if (aspect.Value != null)
                    {
                        RectTransform newPrefab = Instantiate(AspectPrefab);
                        AspectsUI.Add(aspect.Key, newPrefab.GetComponent <AspectItemUI>());
                        newPrefab.transform.SetParent(AspectListParent.transform, false);
                        AspectsUI[aspect.Key].SetAspect(this, aspect.Key, AspectGroup.AspectName(aspect.Key), aspect.Value.TargetDistribution);
                    }
                }
            }
        }