當前位置: 首頁>>代碼示例>>C#>>正文


C# MyEntity.HighlightEntity方法代碼示例

本文整理匯總了C#中MinerWars.AppCode.Game.Entities.MyEntity.HighlightEntity方法的典型用法代碼示例。如果您正苦於以下問題:C# MyEntity.HighlightEntity方法的具體用法?C# MyEntity.HighlightEntity怎麽用?C# MyEntity.HighlightEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MinerWars.AppCode.Game.Entities.MyEntity的用法示例。


在下文中一共展示了MyEntity.HighlightEntity方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddEntityToSelection

        /// <summary>
        /// Adds entity to selection
        /// </summary>
        /// <param name="entity"></param>
        public static void AddEntityToSelection(MyEntity entity)
        {
            ////if animated - disable animation
            //MyEntities.RegisterForStopAnimations(entity);
            if (!(entity is MinerWars.AppCode.Game.Entities.InfluenceSpheres.MyInfluenceSphere))
            {
                UnregistreEntityFromUpdateRecursive(entity);
            }
            

            if (MyFakes.POST_MYENTITYANIMATOR_VALUES)
            {
                Quaternion rotation = Quaternion.CreateFromRotationMatrix(entity.WorldMatrix);
                Debug.WriteLine(string.Format("animator.AddKey(,new Vector3({0:0.0##}f, {1:0.0##}f, {2:0.0##}f), new Quaternion({3:0.0##}f, {4:0.0##}f, {5:0.0##}f, {6:0.0##}f));",
                    entity.WorldMatrix.Translation.X, entity.WorldMatrix.Translation.Y, entity.WorldMatrix.Translation.Z,
                    rotation.X, rotation.Y, rotation.Z, rotation.W));
            }

            // disable selecting another prefabs or object except ones in prefab container
            if (MyEditor.Static.GetEditedPrefabContainer() != null)
            {
                MyPrefabContainer selectedPrefabContainer = null;
                MyEntity selectedEntity = entity;

                while (selectedEntity != null)
                {
                    selectedPrefabContainer = selectedEntity.Parent as MyPrefabContainer;
                    if (selectedPrefabContainer != null)
                        break;

                    selectedEntity = selectedEntity.Parent;
                }

                if (selectedPrefabContainer != MyEditor.Static.GetEditedPrefabContainer())
                    return;
            }

            if (entity == MyEditor.Static.GetEditedPrefabContainer()) return;

            if (SelectedSnapPoint != null) return;

            entity = MySelectionTool.GetSelectableEntity(entity);
            
            if (entity != null)
            {
                /*
                if (entity is MyPrefabLargeWeapon)
                {
                    ((MyPrefabLargeWeapon)entity).GetGun().ForceDeactivate();
                    ((MyPrefabLargeWeapon)entity).GetGun().HighlightEntity(ref MyEditorConstants.SELECTED_OBJECT_DIFFUSE_COLOR_ADDITION);
                    entity.HighlightEntity(ref MyEditorConstants.SELECTED_OBJECT_DIFFUSE_COLOR_ADDITION);
                }  */                               
                
                //@ get selectable entity
                if (SelectedEntities.Contains(entity) == false)
                {                    
                    //@ hack coz prefab containers
                    if (MyEditor.Static.GetEditedPrefabContainer() != null && MyEditor.Static.GetEditedPrefabContainer().HasEditState())
                        MyEditor.Static.GetEditedPrefabContainer().UpdateEditedNode(entity);                    

                    SelectedEntities.Add(entity);                    
                }                

                if (entity is MyVoxelMap) SwitchGizmoMode();

                entity.HighlightEntity(ref MyEditorConstants.SELECTED_OBJECT_DIFFUSE_COLOR_ADDITION);                
            }
        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:72,代碼來源:MyEditorGizmo.cs


注:本文中的MinerWars.AppCode.Game.Entities.MyEntity.HighlightEntity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。