示例#1
0
        public AmountInstance(Amount amount, GameObject game_object)
            : base(game_object, amount)
        {
            Attributes attributes = game_object.GetAttributes();

            minAttribute   = attributes.Add(amount.minAttribute);
            maxAttribute   = attributes.Add(amount.maxAttribute);
            deltaAttribute = attributes.Add(amount.deltaAttribute);
        }
示例#2
0
        public string GetProfessionDescriptionString()
        {
            AttributeInstance profession = GetProfession();

            if ((int)profession.GetTotalValue() == 0)
            {
                return(DUPLICANTS.ATTRIBUTES.UNPROFESSIONAL_DESC);
            }
            return(string.Format(DUPLICANTS.ATTRIBUTES.PROFESSION_DESC, profession.modifier.Name));
        }
示例#3
0
        public string GetProfessionString(bool longform = true)
        {
            AttributeInstance profession = GetProfession();

            if ((int)profession.GetTotalValue() == 0)
            {
                return(string.Format((!longform) ? UI.ATTRIBUTELEVEL_SHORT : UI.ATTRIBUTELEVEL, 0, DUPLICANTS.ATTRIBUTES.UNPROFESSIONAL_NAME));
            }
            return(string.Format((!longform) ? UI.ATTRIBUTELEVEL_SHORT : UI.ATTRIBUTELEVEL, (int)profession.GetTotalValue(), profession.modifier.ProfessionName));
        }
示例#4
0
        public AttributeInstance Add(Attribute attribute)
        {
            AttributeInstance attributeInstance = Get(attribute.Id);

            if (attributeInstance == null)
            {
                attributeInstance = new AttributeInstance(gameObject, attribute);
                AttributeTable.Add(attributeInstance);
            }
            return(attributeInstance);
        }
示例#5
0
        public float GetValue(string id)
        {
            float             result            = 0f;
            AttributeInstance attributeInstance = Get(id);

            if (attributeInstance != null)
            {
                result = attributeInstance.GetTotalValue();
            }
            else
            {
                Debug.LogError("Could not find attribute " + id);
            }
            return(result);
        }
示例#6
0
        public float GetValuePercent(string attribute_id)
        {
            float             result            = 1f;
            AttributeInstance attributeInstance = Get(attribute_id);

            if (attributeInstance != null)
            {
                result = attributeInstance.GetTotalValue() / attributeInstance.GetBaseValue();
            }
            else
            {
                Debug.LogError("Could not find attribute " + attribute_id);
            }
            return(result);
        }
示例#7
0
        public AttributeInstance GetProfession()
        {
            AttributeInstance attributeInstance = null;

            using (IEnumerator <AttributeInstance> enumerator = GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AttributeInstance current = enumerator.Current;
                    if (current.modifier.IsProfession)
                    {
                        if (attributeInstance == null)
                        {
                            attributeInstance = current;
                        }
                        else if (attributeInstance.GetTotalValue() < current.GetTotalValue())
                        {
                            attributeInstance = current;
                        }
                    }
                }
                return(attributeInstance);
            }
        }
示例#8
0
 public AttributeLevel(AttributeInstance attribute)
 {
     notification   = new Notification(MISC.NOTIFICATIONS.LEVELUP.NAME, NotificationType.Good, HashedString.Invalid, OnLevelUpTooltip, null, true, 0f, null, null, null);
     this.attribute = attribute;
 }
示例#9
0
 public string GetTooltip(AttributeInstance instance)
 {
     return(formatter.GetTooltip(this, instance));
 }
示例#10
0
 public string GetDescription(AttributeInstance instance)
 {
     return(instance.GetDescription());
 }
示例#11
0
 public AttributeConverterInstance(GameObject game_object, AttributeConverter converter, AttributeInstance attribute_instance)
     : base(game_object, converter)
 {
     this.converter    = converter;
     attributeInstance = attribute_instance;
 }