public int GetLevel(float val) { SkillCurveKey key = this.GetKey(val); if (val >= Skill.s_MaxValue) { return(key.m_Index + 1); } return(key.m_Index); }
public void Load(Key key) { for (int i = 0; i < key.GetKeysCount(); i++) { Key key2 = key.GetKey(i); if (key2.GetName() == "Key") { SkillCurveKey skillCurveKey = new SkillCurveKey(); skillCurveKey.Load(key2); this.AddKey(skillCurveKey); } } }
private void Setup() { foreach (MenuDebugSkills.SkillUISlot skillUISlot in this.m_Skills) { skillUISlot.level.text = "Level: " + skillUISlot.skill.m_Level.ToString() + "/" + skillUISlot.skill.m_LevelsCount.ToString(); skillUISlot.value.text = string.Concat(new object[] { "Value: ", skillUISlot.skill.m_Value.ToString(), "/", Skill.s_MaxValue }); skillUISlot.value_slider.value = skillUISlot.skill.m_Value; SkillCurveKey key = skillUISlot.skill.m_Progress.GetKey(skillUISlot.skill.m_Value); skillUISlot.next_level.text = "Next level: " + key.m_Data.y.ToString(); } }
public float Evaluate(float val) { SkillCurveKey key = this.GetKey(val); float result; if (val == key.m_Data.x) { result = key.m_Data.z; } else { SkillCurveKey nextKey = this.GetNextKey(key); float proportionalClamp = CJTools.Math.GetProportionalClamp(0f, 1f, val, key.m_Data.x, key.m_Data.y); result = CJTools.Math.GetProportionalClamp(key.m_Data.z, nextKey.m_Data.z, proportionalClamp, 0f, 1f); } return(result); }
private SkillCurveKey GetPrevKey(SkillCurveKey key) { int i = 0; while (i < this.m_Curve.Count) { if (key == this.m_Curve[i]) { if (i == 0) { return(key); } return(this.m_Curve[i - 1]); } else { i++; } } DebugUtils.Assert("[SkillProgressCurve:] Error, can't find key!", true, DebugUtils.AssertType.Info); return(null); }
public float Progress(float val) { SkillCurveKey key = this.GetKey(val); return(key.m_Data.z); }
public void AddKey(SkillCurveKey key) { key.m_Index = this.m_Curve.Count; this.m_Curve.Add(key); }