本文整理汇总了C#中MinerWars.AppCode.Game.Entities.MyEntity.GetHUDDamageRatio方法的典型用法代码示例。如果您正苦于以下问题:C# MyEntity.GetHUDDamageRatio方法的具体用法?C# MyEntity.GetHUDDamageRatio怎么用?C# MyEntity.GetHUDDamageRatio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MinerWars.AppCode.Game.Entities.MyEntity
的用法示例。
在下文中一共展示了MyEntity.GetHUDDamageRatio方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDirectionIndicator
// Adds direction indicators (arrows) and their corresponding text with distance to object
// Right now it displays only 1 object - because it's only for testing purpose
private static void AddDirectionIndicator(MyEntity target, MyHudEntityParams hudParams)
{
if ((target == null) || target == MySession.PlayerShip)
return;
//MyRender.GetRenderProfiler().StartProfilingBlock("CanDisplayLockedTarget");
MyEntity targetEntity = MySession.PlayerShip.TargetEntity;
bool isLockedSideTarget = false;
bool isLockedTarget = false;
if (CanDisplayLockedTarget())
{
isLockedSideTarget = MySession.PlayerShip.SideTargets.Contains(target);
isLockedTarget = targetEntity == target;
}
// MyRender.GetRenderProfiler().StartNextBlock("GetGuiTargetMode");
hudParams.FlagsEnum &= ~MyHudIndicatorFlagsEnum.SHOW_LOCKED_TARGET;
hudParams.FlagsEnum &= ~MyHudIndicatorFlagsEnum.SHOW_LOCKED_SIDE_TARGET;
if (isLockedTarget)
{
hudParams.FlagsEnum |= MyHudIndicatorFlagsEnum.SHOW_LOCKED_TARGET;
}
else
if (isLockedSideTarget)
{
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");
//.........这里部分代码省略.........