public override void OnAddedToContainer(MyComponentContainer container) { base.OnAddedToContainer(container); m_syncObject = container.Get<MySyncComponentBase>(); m_physics = container.Get<MyPhysicsComponentBase>(); m_hierarchy = container.Get<MyHierarchyComponentBase>(); container.ComponentAdded += container_ComponentAdded; }
void container_ComponentRemoved(Type type, MyComponentBase comp) { if (type == typeof(MySyncComponentBase)) m_syncObject = null; else if (type == typeof(MyPhysicsComponentBase)) m_physics = null; else if (type == typeof(MyHierarchyComponentBase)) m_hierarchy = null; }
void container_ComponentAdded(Type type, MyComponentBase comp) { if (type == typeof(MySyncComponentBase)) m_syncObject = comp as MySyncComponentBase; else if (type == typeof(MyPhysicsComponentBase)) m_physics = comp as MyPhysicsComponentBase; else if (type == typeof(MyHierarchyComponentBase)) m_hierarchy = comp as MyHierarchyComponentBase; }