public override void OnBeforeRemovedFromContainer()
        {
            if (m_parentContainer != null)
            {
                m_parentContainer.ComponentAdded   -= Container_ComponentAdded;
                m_parentContainer.ComponentRemoved -= Container_ComponentRemoved;
                m_parentContainer = null;
            }

            m_parent = null;

            base.OnBeforeRemovedFromContainer();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MyEntity"/> class.
        /// </summary>
        public MyEntity(bool initComponents = true)
        {
            Components = new MyEntityComponentContainer(this);
            Components.ComponentAdded += Components_ComponentAdded;
            Components.ComponentRemoved += Components_ComponentRemoved;

            this.Flags = EntityFlags.Default;

            if (initComponents)
            {
                this.m_hudParams = new List<MyHudEntityParams>(1);
                this.Hierarchy = new MyHierarchyComponent<MyEntity>();
                this.GameLogic = new MyNullGameLogicComponent();
                this.PositionComp = new MyPositionComponent();

                PositionComp.LocalMatrix = Matrix.Identity;

                CreateStandardRenderComponentsExtCallback(this);
            }
        }
        public override void OnBeforeRemovedFromContainer()
        {
            if (m_parentContainer != null)
            {
                m_parentContainer.ComponentAdded -= Container_ComponentAdded;
                m_parentContainer.ComponentRemoved -= Container_ComponentRemoved;
                m_parentContainer = null;
            }

            m_parent = null;

            base.OnBeforeRemovedFromContainer();
        }