当前位置: 首页>>代码示例>>C#>>正文


C# MyEntity.GetHUDMarkerPosition方法代码示例

本文整理汇总了C#中MinerWars.AppCode.Game.Entities.MyEntity.GetHUDMarkerPosition方法的典型用法代码示例。如果您正苦于以下问题:C# MyEntity.GetHUDMarkerPosition方法的具体用法?C# MyEntity.GetHUDMarkerPosition怎么用?C# MyEntity.GetHUDMarkerPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MinerWars.AppCode.Game.Entities.MyEntity的用法示例。


在下文中一共展示了MyEntity.GetHUDMarkerPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddDirectionIndicator


//.........这里部分代码省略.........
                {
                    hudParams.FlagsEnum |= MyHudIndicatorFlagsEnum.SHOW_LOCKED_SIDE_TARGET;
                }

            float targetDamageRatio = -1.0f;
            float targetArmorRatio = -1.0f;
            bool addToHudEnemies = false;
            float alphaMultiplifier = 1f;
            MyHudSetting hudSettings = null;
            MyHudAlphaCorrection hudAlphaCorrection = null;

            MyGuitargetMode hudSettingsTargetMode;
            MyGuitargetMode alphaCorrectionTargetMode;
            GetGuiTargetMode(target, hudParams, out hudSettingsTargetMode, out alphaCorrectionTargetMode);
            MyFactionRelationEnum status = MyFactions.GetFactionsRelation(target, MySession.PlayerShip);

            //MyRender.GetRenderProfiler().StartNextBlock("IsMissionEntity");

            if (MyMissions.IsMissionEntity(target))
            {
                if (MyMissions.IsNewMissionOrObjectiveAvailable())
                {
                    alphaMultiplifier *= m_missionHighlight;
                }
            }
            else
            {
                // some entities can have displaying dependents on faction relation
                if (!hudParams.DisplayFactionRelation.CanBeDisplayed(status))
                {
                    //MyRender.GetRenderProfiler().EndProfilingBlock();
                    return;
                }                               
            }

           // MyRender.GetRenderProfiler().StartNextBlock("GetHUDDamageRatio");

            hudSettings = m_hudSettings[(int)hudSettingsTargetMode];
            hudAlphaCorrection = m_hudAlphaCorrection[(int)alphaCorrectionTargetMode];

            if (status == MyFactionRelationEnum.Enemy)
            {
                addToHudEnemies = MyMissile.CanBeTargeted(target);
                if (target is MySmallShip) 
                {
                    hudSettings = m_hudSettings[(int)MyGuitargetMode.Enemy];
                }
            }
            
            targetDamageRatio = target.GetHUDDamageRatio();
            MySmallShip targetShip = target as MySmallShip;
            if (targetShip != null)
            {
                if (targetShip.Armor != null)
                {
                    targetArmorRatio = MathHelper.Clamp(targetShip.ArmorHealth / targetShip.MaxArmorHealth, 0, 1);
                }
            }

            //// when target is hangar, we want display healthbar of large ship from his prefab container
            //MyPrefabHangar targetHangar = target as MyPrefabHangar;
            //if(targetHangar != null)
            //{
            //    List<MyPrefabBase> largeShips = targetHangar.GetOwner().GetPrefabs(CategoryTypesEnum.LARGE_SHIPS);
            //    if(largeShips.Count > 0)
            //    {
            //        targetDamageRatio = largeShips[0].GetDamageRatio();
            //    }
            //}

            //MyRender.GetRenderProfiler().StartNextBlock("IsElectrified");

            bool displayUnpowered = false;
            MyPrefabBase targetPrefab = target as MyPrefabBase;
            if (targetPrefab != null) 
            {
                displayUnpowered = !targetPrefab.IsElectrified();
            }
            
            if (isLockedTarget)
            {
                hudSettings = m_hudSettings[(int)MyGuitargetMode.Enemy];                
            }

            //MyRender.GetRenderProfiler().StartNextBlock("GetHUDMarkerPosition");

            // Show in center of objects (pivots are not centered atm.)
            Vector3 position = target.GetHUDMarkerPosition();

            //MyRender.GetRenderProfiler().StartNextBlock("AddDirectionIndicator");

            float? distanceFromScreenCenter = AddDirectionIndicator(hudSettings, position, hudParams, targetDamageRatio, targetArmorRatio, Color.White, hudAlphaCorrection, displayUnpowered, alphaMultiplifier);

            if (addToHudEnemies && distanceFromScreenCenter != null) 
            {
                m_hudEnemies.Add(target, distanceFromScreenCenter.Value);
            }

           // MyRender.GetRenderProfiler().EndProfilingBlock();
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:101,代码来源:MyHud.cs


注:本文中的MinerWars.AppCode.Game.Entities.MyEntity.GetHUDMarkerPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。