// 取得加乘过的Soldier角色数值 public override SoldierAttr GetEliteSoldierAttr(ENUM_AttrDecorator emType, int AttrID, SoldierAttr theSoldierAttr) { // 取得加乘效果的数值 AdditionalAttr theAdditionalAttr = GetAdditionalAttr(AttrID); if (theAdditionalAttr == null) { Debug.LogWarning("GetEliteSoldierAttr:加乘数值[" + AttrID + "]不存在"); return(theSoldierAttr); } // 产生装饰者 BaseAttrDecorator theAttrDecorator = null; switch (emType) { case ENUM_AttrDecorator.Prefix: theAttrDecorator = new PrefixBaseAttr(); break; case ENUM_AttrDecorator.Suffix: theAttrDecorator = new SuffixBaseAttr(); break; } if (theAttrDecorator == null) { Debug.LogWarning("GetEliteSoldierAttr:无法针对[" + emType + "]产生装饰者"); return(theSoldierAttr); } // 设定装饰對像及加乘数值 theAttrDecorator.SetComponent(theSoldierAttr.GetBaseAttr()); theAttrDecorator.SetAdditionalAttr(theAdditionalAttr); // 设定新的数值后回传 theSoldierAttr.SetBaseAttr(theAttrDecorator); return(theSoldierAttr); // 回传 }
// 取得加乘過的Soldier角色數值 public override SoldierAttr GetEliteSoldierAttr(ENUM_AttrDecorator emType, int AttrID, SoldierAttr theSoldierAttr) { // 取得加乘效果的數值 AdditionalAttr theAdditionalAttr = GetAdditionalAttr(AttrID); if (theAdditionalAttr == null) { Debug.LogWarning("GetEliteSoldierAttr:加乘數值[" + AttrID + "]不存在"); return(theSoldierAttr); } // 產生裝飾者 BaseAttrDecorator theAttrDecorator = null; switch (emType) { case ENUM_AttrDecorator.Prefix: theAttrDecorator = new PrefixBaseAttr(); break; case ENUM_AttrDecorator.Suffix: theAttrDecorator = new SuffixBaseAttr(); break; } if (theAttrDecorator == null) { Debug.LogWarning("GetEliteSoldierAttr:無法針對[" + emType + "]產生裝飾者"); return(theSoldierAttr); } // 設定裝飾對像及加乘數值 theAttrDecorator.SetComponent(theSoldierAttr.GetBaseAttr()); theAttrDecorator.SetAdditionalAttr(theAdditionalAttr); // 設定新的數值後回傳 theSoldierAttr.SetBaseAttr(theAttrDecorator); return(theSoldierAttr); // 回傳 }
// 設定額外使用的值 public void SetAdditionalAttr(AdditionalAttr theAdditionalAttr) { m_AdditionialAttr = theAdditionalAttr; }
// 設定額外使用的值 public void SetAdditionalAttr (AdditionalAttr theAdditionalAttr) { m_AdditionialAttr = theAdditionalAttr; }