public virtual void RemoveController(IController model)
 {
     if (m_ControllerList != null)
     {
         m_ControllerList.Remove(model);
     }
 }
Beispiel #2
0
        private void ProcessRemovedItems()
        {
            //Remove any new geometries
            for (int i = 0; i < geomRemoveList.Count; i++)
            {
                geomRemoveList[i].isRemoved = true;
                geomList.Remove(geomRemoveList[i]);

                //Remove any arbiters associated with the geometries being removed
                for (int j = arbiterList.Count; j > 0; j--)
                {
                    if (arbiterList[j - 1].GeometryA == geomRemoveList[i] ||
                        arbiterList[j - 1].GeometryB == geomRemoveList[i])
                    {
                        arbiterList.Remove(arbiterList[j - 1]);
                    }
                }
            }

            if (geomRemoveList.Count > 0)
            {
                _broadPhaseCollider.ProcessRemovedGeoms();
            }

            geomRemoveList.Clear();

            //Remove any new bodies
            for (int i = 0; i < bodyRemoveList.Count; i++)
            {
                bodyList.Remove(bodyRemoveList[i]);
            }
            bodyRemoveList.Clear();

            //Remove any new controllers
            for (int i = 0; i < controllerRemoveList.Count; i++)
            {
                controllerList.Remove(controllerRemoveList[i]);
            }
            controllerRemoveList.Clear();

            //Remove any new joints
            for (int i = 0; i < jointRemoveList.Count; i++)
            {
                jointList.Remove(jointRemoveList[i]);
            }
            jointRemoveList.Clear();

            //Remove any new springs
            for (int i = 0; i < springRemoveList.Count; i++)
            {
                springList.Remove(springRemoveList[i]);
            }
            springRemoveList.Clear();
        }
Beispiel #3
0
        public void RemoveController(Controller controller)
        {
            Debug.Assert(ControllerList.Contains(controller),
                         "You are removing a controller that is not in the simulation.");

            if (ControllerList.Contains(controller))
            {
                ControllerList.Remove(controller);

                ControllerRemoved?.Invoke(controller);
            }
        }
        /// <summary>
        /// Processes the removed geometries (and their arbiters), bodies, controllers, joints and springs.
        /// </summary>
        private void ProcessRemovedItems()
        {
            //Remove any new geometries
            _tempCount = _geomRemoveList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                _geomRemoveList[i].InSimulation = false;
                GeomList.Remove(_geomRemoveList[i]);

                //Remove any arbiters associated with the geometries being removed
                for (int j = ArbiterList.Count; j > 0; j--)
                {
                    if (ArbiterList[j - 1].GeometryA == _geomRemoveList[i] ||
                        ArbiterList[j - 1].GeometryB == _geomRemoveList[i])
                    {
                        //TODO: Should we create a RemoveComplete method and remove all Contacts associated
                        //with the arbiter?
                        arbiterPool.Insert(ArbiterList[j - 1]);
                        ArbiterList.Remove(ArbiterList[j - 1]);
                    }
                }
            }

            if (_geomRemoveList.Count > 0)
            {
                _broadPhaseCollider.ProcessRemovedGeoms();
            }

            _geomRemoveList.Clear();

            //Remove any new bodies
            _tempCount = _bodyRemoveList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                BodyList.Remove(_bodyRemoveList[i]);
            }
            _bodyRemoveList.Clear();

            //Remove any new controllers
            _tempCount = _controllerRemoveList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                ControllerList.Remove(_controllerRemoveList[i]);
            }
            _controllerRemoveList.Clear();

            //Remove any new joints
            int jointRemoveCount = _jointRemoveList.Count;

            for (int i = 0; i < jointRemoveCount; i++)
            {
                JointList.Remove(_jointRemoveList[i]);
            }
            _jointRemoveList.Clear();

            //Remove any new springs
            _tempCount = _springRemoveList.Count;
            for (int i = 0; i < _tempCount; i++)
            {
                SpringList.Remove(_springRemoveList[i]);
            }
            _springRemoveList.Clear();
        }