Esempio n. 1
0
 public MyEditorActionEntityCopy(List <MyEntity> actionEntities)
     : base(actionEntities, true)
 {
     ActionEntities.Clear();
     SourceEntities = new List <MyEntity>();
     SourceEntities.AddRange(actionEntities);
     AddChildren();
     RemapEntityIdsOnInit();
 }
 /// <summary>
 /// Removes entities(in separate thread if needed - voxelmaps)
 /// </summary>
 internal void RemoveInBackgroundThread()
 {
     // Remove in separate thread only for voxel maps
     if (ActionEntities.OfType <MyVoxelMap>().Any())
     {
         Thread thread = new Thread(new ThreadStart(this.RemoveFromScene));
         thread.Name = "RemoveFromScene";
         MyEditor.Static.StartBackgroundThread(thread);
         MyGuiManager.AddScreen(new MyGuiScreenEditorProgress(MyTextsWrapperEnum.LoadingPleaseWait, false));
     }
     else
     {
         RemoveFromScene();
     }
 }
        /// <summary>
        /// Remove all action entities
        /// </summary>
        protected virtual void RemoveFromScene()
        {
            foreach (MyEntity actionEntity in ActionEntities)
            {
                //dont delete player ship
                if (actionEntity == MySession.PlayerShip)
                {
                    continue;
                }

                MyEditorGizmo.RemoveEntityFromSelection(actionEntity);

                if (actionEntity == MyEditor.Static.GetEditedPrefabContainer())
                {
                    MyEditor.Static.ResetActivePrefabContainer();
                }

                MyEditor.Static.DeleteEntityFromCollidingList(actionEntity);

                if (!(actionEntity is MyPrefabBase))
                {
                    if (m_activeContainer == null && MyEditor.Static.IsEditingPrefabContainer())
                    {
                        MyEditor.Static.ExitActivePrefabContainer();
                    }
                }
                else
                {
                    MyEditor.Static.EditPrefabContainer(m_activeContainer);
                }

                actionEntity.MarkForClose();

                MyEditor.Static.RecheckAllColidingEntitesAndClearNonColiding();
            }

            ActionEntities.Clear();

            MyAudio.AddCue2D(MySoundCuesEnum.GuiEditorObjectDelete);
        }