//------------------------------------------------------------------------------------------------------- public void AddPart(EntityPart enPart) { int entityPart = (int)enPart; if (m_Parts.ContainsKey(entityPart)) { return; } switch (enPart) { case EntityPart.Skill: // 技能 { ISkillSystem skillSys = EntitySystem.m_ClientGlobal.GetSkillSystem(); if (skillSys == null) { //编辑器模式不需要 break; } ISkillPart skillPart = skillSys.CreateSkillPart(); if (skillPart == null) { return; } if (!skillPart.Create(this)) { Engine.Utility.Log.Error("AddPart failed!"); skillPart = null; return; } m_Parts[entityPart] = skillPart; break; } case EntityPart.Buff: // Buff { ISkillSystem skillSys = EntitySystem.m_ClientGlobal.GetSkillSystem(); if (skillSys == null) { //编辑器模式不需要 break; } IBuffPart buffpart = skillSys.CreateBuffPart(); if (buffpart == null) { return; } if (!buffpart.Create(this)) { Engine.Utility.Log.Error("AddPart failed!"); buffpart = null; return; } m_Parts[entityPart] = buffpart; break; } case EntityPart.Equip: // Equip 装备 { IEquipPart equipPart = new EquipPart(); if (equipPart == null) { return; } if (!equipPart.Create(this)) { Engine.Utility.Log.Error("AddPart failed!"); equipPart = null; return; } m_Parts[entityPart] = equipPart; break; } } }