Esempio n. 1
0
        /// <summary>
        /// Removes entity from selection
        /// </summary>
        /// <param name="entity"></param>
        public static void RemoveEntityFromSelection(MyEntity entity)
        {
            ////enable object again
            //MyEntities.UnregisterForStopAnimations(entity);
            if (!(entity is MinerWars.AppCode.Game.Entities.InfluenceSpheres.MyInfluenceSphere))
            {
                MyEntities.RegisterForUpdate(entity);
            }

            // first try to remove the entity on its own (the entity might have become non-selectable)
            if (SelectedEntities.Contains(entity) == true)
            {
                SelectedEntities.Remove(entity);
                entity.ClearHighlightning();
            }

            // do selectable entities
            entity = MySelectionTool.GetSelectableEntity(entity);

            if (entity != null)
            {
                if (SelectedEntities.Contains(entity) == true)
                {                    
                    SelectedEntities.Remove(entity);
                    entity.ClearHighlightning();

                    /*
                    if (entity is MyPrefabLargeWeapon)
                    {
                        ((MyPrefabLargeWeapon)entity).GetGun().ClearHighlightning();
                    } */                                                       
                }

            }
        }
Esempio n. 2
0
 public void RemoveBlinkingObject(MyEntity entity)
 {   
     entity.ClearHighlightning();
     
     while (m_entities.Remove(entity)) { };  // Remove all
     
     if (entity.Children != null)
     {
         foreach (var child in entity.Children)
         {
             RemoveBlinkingObject(child);
         }
     }
 }