示例#1
0
        public void Add(Actor actorToAdd)
        {
            _actors.Add(actorToAdd);

            actorToAdd.LoadContent(Content);
            actorToAdd.InitializeComponents();

            foreach (Component component in actorToAdd.Components)
            {
                if (component is DummyComponent)
                {
                    _space.Add((component as DummyComponent).spaceObject);
                }
                else
                {
                    if (component.Mesh is LPPMesh)
                    {
                        _meshes.Add(component.Mesh as LPPMesh);
                    }
                    _components.Add(component);
                    if (component.Entity != null)
                    {
                        _modelDrawer.Add(component.Entity);
                        _space.Add(component.Entity);
                    }
                }
                foreach (Light light in component.Lights)
                {
                    _lightDrawer.Add(light);
                }
            }
            _constraintDrawer.Clear();
            for (int i = 0; i < _space.Solver.SolverUpdateables.Count; i++)
            {
                //Add the solver updateable and match up the activity setting.
                LineDisplayObjectBase objectAdded = _constraintDrawer.Add(_space.Solver.SolverUpdateables[i]);
                if (objectAdded != null)
                    objectAdded.IsDrawing = _space.Solver.SolverUpdateables[i].IsActive;
            }
            if (actorToAdd.Name != "noname")
                _actorDictionary.Add(actorToAdd.Name, actorToAdd);
        }
示例#2
0
 public void Remove(Actor actorToRemove)
 {
     _deleteList.Add(actorToRemove);
 }
示例#3
0
 private void Delete(Actor actorToDelete)
 {
     foreach (Component component in actorToDelete.Components)
     {
         _meshes.Remove(component.Mesh as LPPMesh);
         _components.Remove(component);
         _modelDrawer.Remove(component.Entity);
         component.CleanUp();
         foreach (Light light in component.Lights)
         {
             _lightDrawer.Remove(light);
         }
     }
     _actors.Remove(actorToDelete);
     if (actorToDelete.Name != "noname")
     {
         _actorDictionary.Remove(actorToDelete.Name);
     }
 }
示例#4
0
 public EntityTag(Actor parentActor, Component parentComponent)
 {
     ParentActor = parentActor;
     ParentComponent = parentComponent;
     useType = UseType.Grab;
 }