public int AddEffect(MyObjectBuilder_EntityStatRegenEffect objectBuilder) { MyEntityStatRegenEffect effect = MyEntityStatEffectFactory.CreateInstance(objectBuilder); effect.Init(objectBuilder, this); int key = 0; while ((key < this.m_effects.Count) && this.m_effects.ContainsKey(key)) { key++; } this.m_effects.Add(key, effect); return(key); }
public int AddEffect(MyObjectBuilder_EntityStatRegenEffect objectBuilder) { var effect = MyEntityStatEffectFactory.CreateInstance(objectBuilder); effect.Init(objectBuilder, this); int nextId = 0; for (; nextId < m_effects.Count; ++nextId) { if (!m_effects.ContainsKey(nextId)) { break; } } m_effects.Add(nextId, effect); return(nextId); }