/// <summary> /// 新增武器的被動施法 /// </summary> void AddPassiveSpell(int _spellID) { if (_spellID == 0) { return; } PassiveSpell spell = new PassiveSpell(_spellID, this); PassiveSpellList.Add(spell); }
/// <summary> /// 初始化施法 /// </summary> protected void SetPassiveSpell() { string spellListStr = AttrsDic["SpellList"]; string[] spellIDStr = spellListStr.Split(','); for (int i = 0; i < spellIDStr.Length; i++) { int spellID = int.Parse(spellIDStr[i]); if (spellID == 0) { continue; } PassiveSpell spell = new PassiveSpell(spellID, this); PassiveSpellList.Add(spell); } }
/// <summary> /// 移除武器的被動施法 /// </summary> void RemovePassiveSpell(int _spellID) { if (_spellID == 0) { return; } bool result = false; //以迴圈搜尋同此ID的被動施法,並移除 for (int i = 0; i < PassiveSpellList.Count; i++) { if (PassiveSpellList[i].ID == _spellID) { PassiveSpellList.RemoveAt(i); break; } } if (!result) { Debug.LogWarning(string.Format("脫下武器時,找不到要移除的被動施法ID({0})", _spellID)); } }