protected override void OnPrefabInit() { foreach (AttributeInstance attribute in this.GetAttributes()) { foreach (AttributeConverter converter in attribute.Attribute.converters) { AttributeConverterInstance item = new AttributeConverterInstance(base.gameObject, converter, attribute); converters.Add(item); } } }
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); }