using System; using System.Collections.Generic; using System.Text; namespace YLBattle { public class LogicFighterProperty { /// /// 基础值, 创建后不可修改 /// private float mBaseValue; /// /// 修正值,游戏过程中动态附加值 /// private float mCorrectedValue; /// /// 当前值: 基础值 + 修正值 /// private float mValue; /// /// 构造函数 /// /// 初始值 public LogicFighterProperty(float value) { this.mBaseValue = value; this.mCorrectedValue = 0; this.ReplaceTotalValue(); } /// /// 获取当前值 /// /// 当前值 public float GetValue() { return this.mValue; } /// /// 获取基础值 /// /// 基础值 public float GetBaseValue() { return this.mBaseValue; } /// /// 获取修正值 /// /// 修正值 public float GetCorrectedValue() { return this.mCorrectedValue; } /// /// 修改修正值 /// /// 修改值 public void ModifyCorrectedValue(float val) { this.mCorrectedValue += val; this.ReplaceTotalValue(); } /// /// 设置新值 /// /// 设置值 public void SetCorrectedValue(float val) { this.mCorrectedValue = val; this.ReplaceTotalValue(); } /// /// 清空附加值 /// public void ClearCorrectedValue() { this.mCorrectedValue = 0; this.ReplaceTotalValue(); } /// /// 刷新属性总值 /// private void ReplaceTotalValue() { this.mValue = this.mBaseValue + this.mCorrectedValue; } } }