本文整理汇总了C#中Path.tileWhen方法的典型用法代码示例。如果您正苦于以下问题:C# Path.tileWhen方法的具体用法?C# Path.tileWhen怎么用?C# Path.tileWhen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path.tileWhen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addWaypoint
public void addWaypoint(long time, Path path)
{
if (Sim.enableNonLivePaths && type.speed > 0) {
if (!new SegmentUnit(path.segmentWhen(time), this).canBeUnambiguousParent(time)) time++;
Tile tile = path.tileWhen (time);
if (!Waypoint.active (tile.waypointLatest (this))) {
List<UnitSelection> start = new List<UnitSelection> { new UnitSelection(path, this, time) };
SegmentUnit prev = start[0].segmentUnit();
do {
// remember segments that unit was previously on in case unit is later removed from them
SegmentUnit cur = prev;
prev = cur.prev ().FirstOrDefault ();
if (prev.g == null || prev.segment.path != cur.segment.path || !prev.segment.unseen) {
start.Add (new UnitSelection(cur.segment.path, this, cur.segment.timeStart));
}
} while (prev.g != null && prev.segment.unseen);
g.events.addEvt (new WaypointAddEvt(time + (tile.centerPos() - path.posWhen(time)).length () / type.speed,
this, tile, null, start));
}
}
}
示例2: pathDrawPos
// methods above involve commanding selected units
/// <summary>
/// sets pos to where base of path should be drawn at, and returns whether it should be drawn
/// </summary>
private bool pathDrawPos(Path path, ref Vector3 pos)
{
if (g.timeGame < path.moves[0].timeStart) return false;
if (selPlayer != path.player) {
if (path.timeSimPast != long.MaxValue) return false;
if (!path.tileWhen (g.timeGame).playerVisWhen(selPlayer, g.timeGame)) return false;
}
pos = simToDrawPos(path.posWhen(g.timeGame), unitDepth);
return true;
}