本文整理汇总了C#中IMyEntity.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IMyEntity.ToString方法的具体用法?C# IMyEntity.ToString怎么用?C# IMyEntity.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMyEntity
的用法示例。
在下文中一共展示了IMyEntity.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Entities_OnEntityAdd
private static void Entities_OnEntityAdd(IMyEntity obj)
{
if (obj is MyAmmoBase && obj.ToString().StartsWith("MyMissile"))
{
Registrar.ForEach((GuidedMissileLauncher launcher) => {
return launcher.MissileBelongsTo(obj);
});
}
}
示例2: CanTargetType
public bool CanTargetType(IMyEntity entity)
{
IMyCubeGrid grid = entity as IMyCubeGrid;
if (grid != null)
{
if (grid.IsStatic)
return CanTargetType(TargetType.Station);
if (grid.GridSizeEnum == Sandbox.Common.ObjectBuilders.MyCubeSize.Large)
return CanTargetType(TargetType.LargeGrid);
if (grid.GridSizeEnum == Sandbox.Common.ObjectBuilders.MyCubeSize.Small)
return CanTargetType(TargetType.SmallGrid);
throw new Exception("Unknown grid size: " + grid.DisplayName);
}
if (entity is IMyCharacter)
return CanTargetType(TargetType.Character);
if (entity is IMyMeteor)
return CanTargetType(TargetType.Meteor);
if (entity.ToString().StartsWith("MyMissile"))
return CanTargetType(TargetType.Missile);
return false;
}
示例3: AddTarget
/// <summary>
/// Adds a target to Available_Targets
/// </summary>
private void AddTarget(TargetType tType, IMyEntity target)
{
if (!Options.CanTargetType(tType))
return;
if (target.ToString().StartsWith("MyMissile"))
{
myLogger.debugLog("missile: " + target.getBestName() + ", type = " + tType + ", allowed targets = " + Options.CanTarget, "AddTarget()");
}
List<IMyEntity> list;
if (!Available_Targets.TryGetValue(tType, out list))
{
list = new List<IMyEntity>();
Available_Targets.Add(tType, list);
}
list.Add(target);
}