Example #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);
        }
Example #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));
        }
Example #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));
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
            }
        }
Example #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;
 }
Example #9
0
 public string GetTooltip(AttributeInstance instance)
 {
     return(formatter.GetTooltip(this, instance));
 }
Example #10
0
 public string GetDescription(AttributeInstance instance)
 {
     return(instance.GetDescription());
 }
Example #11
0
 public AttributeConverterInstance(GameObject game_object, AttributeConverter converter, AttributeInstance attribute_instance)
     : base(game_object, converter)
 {
     this.converter    = converter;
     attributeInstance = attribute_instance;
 }