public virtual void ApplyAttrs(eCreatureProp propType, int newV, int oldV) { int index = (int)propType; Action <CCreature, int, int> changeAction; if (m_dicPlayerData.TryGetValue(index, out changeAction)) { changeAction(this, newV, oldV); } }
public virtual void AddPropNum(eCreatureProp propType, int addV) { int index = (int)propType; if (index < m_arrProp.Length) { int oldV = m_arrProp[index]; int newV = oldV + addV; m_arrProp[index] = newV; ApplyAttrs(propType, newV, oldV); } else { Debug.LogError("属性索引越界" + index); } }
public virtual int GetPropNum(eCreatureProp propType) { if (m_arrProp == null) { return(0); } int index = (int)propType; if (index < m_arrProp.Length) { return(m_arrProp[index]); } else { Debug.LogError("属性索引越界" + index); } return(0); }
public virtual void SetPropNum(eCreatureProp propType, int newV) { if (m_arrProp == null) { //Debug.LogError("找不到属性,检测是不是UID重复时被移除的类:" + m_uId); return; } int index = (int)propType; if (index < m_arrProp.Length) { int oldV = m_arrProp[index]; m_arrProp[index] = newV; ApplyAttrs(propType, newV, oldV); } else { Debug.LogError("属性索引越界" + index); } }