Example #1
0
        public void SetExperience(string attribute_id, float experience)
        {
            AttributeLevel attributeLevel = GetAttributeLevel(attribute_id);

            if (attributeLevel != null)
            {
                attributeLevel.SetExperience(experience);
                attributeLevel.Apply(this);
            }
        }
Example #2
0
        public void SetLevel(string attribute_id, int level)
        {
            AttributeLevel attributeLevel = GetAttributeLevel(attribute_id);

            if (attributeLevel != null)
            {
                attributeLevel.SetLevel(level);
                attributeLevel.Apply(this);
            }
        }
Example #3
0
 protected override void OnPrefabInit()
 {
     foreach (AttributeInstance attribute in this.GetAttributes())
     {
         if (attribute.Attribute.IsTrainable)
         {
             AttributeLevel attributeLevel = new AttributeLevel(attribute);
             levels.Add(attributeLevel);
             attributeLevel.Apply(this);
         }
     }
 }
Example #4
0
        public int GetMaxLevel()
        {
            int num = 0;

            using (IEnumerator <AttributeLevel> enumerator = GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AttributeLevel current = enumerator.Current;
                    if (current.GetLevel() > num)
                    {
                        num = current.GetLevel();
                    }
                }
                return(num);
            }
        }
Example #5
0
        public bool AddExperience(string attribute_id, float time_spent, float multiplier)
        {
            AttributeLevel attributeLevel = GetAttributeLevel(attribute_id);

            if (attributeLevel == null)
            {
                Debug.LogWarning(attribute_id + " has no level.");
                return(false);
            }
            time_spent *= multiplier;
            AttributeConverterInstance attributeConverterInstance = Db.Get().AttributeConverters.TrainingSpeed.Lookup(this);

            if (attributeConverterInstance != null)
            {
                float num = attributeConverterInstance.Evaluate();
                time_spent += time_spent * num;
            }
            bool result = attributeLevel.AddExperience(this, time_spent);

            attributeLevel.Apply(this);
            return(result);
        }
Example #6
0
        public float GetPercentComplete(string attribute_id)
        {
            AttributeLevel attributeLevel = GetAttributeLevel(attribute_id);

            return(attributeLevel.GetPercentComplete());
        }