本文整理汇总了C#中IMyCubeGrid.RemoveBlock方法的典型用法代码示例。如果您正苦于以下问题:C# IMyCubeGrid.RemoveBlock方法的具体用法?C# IMyCubeGrid.RemoveBlock怎么用?C# IMyCubeGrid.RemoveBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMyCubeGrid
的用法示例。
在下文中一共展示了IMyCubeGrid.RemoveBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateBlockModel
/// <summary>
/// Updates the appearance of the block if the integrity has changed. Only used for welding/griding.
/// </summary>
private static void UpdateBlockModel(IMySlimBlock realBlock, IMyCubeGrid holoGrid)
{
IMySlimBlock holoBlock = holoGrid.GetCubeBlock(realBlock.Position);
Static.logger.debugLog(holoBlock == null, "holoBlock == null", Logger.severity.FATAL);
float realIntegrityRatio = (realBlock.BuildIntegrity - realBlock.CurrentDamage) / realBlock.MaxIntegrity;
float holoIntegrityRatio = (holoBlock.BuildIntegrity - holoBlock.CurrentDamage) / holoBlock.MaxIntegrity;
if (realIntegrityRatio == holoIntegrityRatio)
return;
float min, max;
if (realIntegrityRatio > holoIntegrityRatio)
{
max = realIntegrityRatio;
min = holoIntegrityRatio;
}
else
{
max = holoIntegrityRatio;
min = realIntegrityRatio;
}
if (((MyCubeBlockDefinition)realBlock.BlockDefinition).ModelChangeIsNeeded(min, max))
{
holoGrid.RemoveBlock(holoBlock);
MyObjectBuilder_CubeBlock objBuilder = realBlock.GetObjectBuilder();
objBuilder.EntityId = 0L;
holoGrid.AddBlock(objBuilder, false);
IMyCubeBlock cubeBlock = holoGrid.GetCubeBlock(realBlock.Position).FatBlock;
if (cubeBlock != null)
SetupProjection(cubeBlock);
}
}