本文整理汇总了C#中Sandbox.Game.Entities.MyEntity.getBestName方法的典型用法代码示例。如果您正苦于以下问题:C# MyEntity.getBestName方法的具体用法?C# MyEntity.getBestName怎么用?C# MyEntity.getBestName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Game.Entities.MyEntity
的用法示例。
在下文中一共展示了MyEntity.getBestName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestPath
/// <summary>
/// Test a path between current position and destination.
/// </summary>
private void TestPath(Vector3D destination, MyEntity destEntity, short runId, bool isAlternate, bool tryAlternates, bool slowDown = false)
{
if (!lock_testPath.TryAcquireExclusive())
{
m_logger.debugLog("Already running, requeue (destination:" + destination + ", destEntity: " + destEntity + ", runId :" + runId
+ ", isAlternate: " + isAlternate + ", tryAlternates: " + tryAlternates + ", slowDown: " + slowDown + ")", "TestPath()");
LockedQueue<Action> queue = isAlternate ? m_pathLow : m_pathHigh;
queue.Enqueue(() => TestPath(destination, destEntity, runId, isAlternate, tryAlternates));
return;
}
m_logger.debugLog("Running, (destination:" + destination + ", destEntity: " + destEntity + ", runId :" + runId
+ ", isAlternate: " + isAlternate + ", tryAlternates: " + tryAlternates + ", slowDown: " + slowDown + ")", "TestPath()");
try
{
if (!isAlternate && !tryAlternates)
m_logger.debugLog("velocity based test follows", "TestPath()", Logger.severity.INFO);
if (runId != m_runId)
{
m_logger.debugLog("destination changed, abort", "TestPath()", Logger.severity.DEBUG);
return;
}
if (m_pathChecker.TestFast(m_navBlock, destination, m_ignoreAsteroid, destEntity, m_landing))
{
m_logger.debugLog("path is clear (fast)", "TestPath()", Logger.severity.TRACE);
PathClear(ref destination, runId, isAlternate, slowDown);
return;
}
MyEntity obstructing;
IMyCubeGrid obsGrid;
Vector3? pointOfObstruction;
if (m_pathChecker.TestSlow(out obstructing, out obsGrid, out pointOfObstruction))
{
m_logger.debugLog("path is clear (slow)", "TestPath()", Logger.severity.TRACE);
PathClear(ref destination, runId, isAlternate, slowDown);
return;
}
if (runId != m_runId)
{
m_logger.debugLog("destination changed, abort", "TestPath()", Logger.severity.DEBUG);
return;
}
if (slowDown)
{
Vector3 displacement = pointOfObstruction.Value - m_navBlock.WorldPosition;
m_navSet.Settings_Task_NavWay.SpeedMaxRelative = Vector3.Distance(pointOfObstruction.Value, m_navBlock.WorldPosition) / LookAheadSpeed_Seconds;
m_logger.debugLog("Set MaxRelativeSpeed to " + m_navSet.Settings_Task_NavWay.SpeedMaxRelative, "TestPath()", Logger.severity.TRACE);
return;
}
m_pathState = PathState.Searching;
m_logger.debugLog("path is blocked by " + obstructing.getBestName() + " at " + pointOfObstruction + ", destEntity: " + destEntity.getBestName(), "TestPath()", Logger.severity.TRACE);
if (tryAlternates)
{
m_pathHigh.Clear();
Vector3 displacement = pointOfObstruction.Value - m_navBlock.WorldPosition;
if (m_canChangeCourse)
{
FindAlternate_AroundObstruction(displacement, pointOfObstruction.Value, obstructing.GetLinearVelocity(), runId);
FindAlternate_JustMove(runId);
}
FindAlternate_HalfwayObstruction(displacement, runId);
m_pathLow.Enqueue(() => m_pathState = PathState.Path_Blocked);
}
}
finally
{
lock_testPath.ReleaseExclusive();
RunItem();
}
}