public bool AttachScript(GameObjectScript e, bool fireScriptAttachEvent = false) { lock (AttachedScripts) { if (AttachedScripts.Values.Contains(e)) { return(false); } // Add it to the local effects list on the character object AttachedScripts.Add(e.TypeHash, e); // Fire the attached even so that the effect can set itself up and // so that it gets registered with the game event system if (fireScriptAttachEvent) { e.OnAttach(m_OwningObject); } foreach (GameEventType eid in e.ListeningEvents) { SubscribeToEvent(eid, e); } } return(true); }