本文整理汇总了C#中OpenMetaverse.Simulator.TerrainHeightAtPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Simulator.TerrainHeightAtPoint方法的具体用法?C# Simulator.TerrainHeightAtPoint怎么用?C# Simulator.TerrainHeightAtPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenMetaverse.Simulator
的用法示例。
在下文中一共展示了Simulator.TerrainHeightAtPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Terraform
/// <summary>
/// Terraform (raise, lower, etc) an area or whole parcel of land
/// </summary>
/// <param name="simulator">Simulator land area is in.</param>
/// <param name="localID">LocalID of parcel, or -1 if using bounding box</param>
/// <param name="west">west border of area to modify</param>
/// <param name="south">south border of area to modify</param>
/// <param name="east">east border of area to modify</param>
/// <param name="north">north border of area to modify</param>
/// <param name="action">From Enum, Raise, Lower, Level, Smooth, Etc.</param>
/// <param name="brushSize">Size of area to modify</param>
/// <param name="seconds">How many meters + or - to lower, 1 = 1 meter</param>
/// <returns>true on successful request sent.</returns>
/// <remarks>Settings.STORE_LAND_PATCHES must be true,
/// Parcel information must be downloaded using <code>RequestAllSimParcels()</code></remarks>
public bool Terraform(Simulator simulator, int localID, float west, float south, float east, float north,
TerraformAction action, TerraformBrushSize brushSize, int seconds)
{
float height = 0f;
int x, y;
if (localID == -1)
{
x = (int)east - (int)west / 2;
y = (int)north - (int)south / 2;
}
else
{
Parcel p;
if (!simulator.Parcels.TryGetValue(localID, out p))
{
Logger.Log(String.Format("Can't find parcel {0} in simulator {1}", localID, simulator),
Helpers.LogLevel.Warning, Client);
return false;
}
x = (int)p.AABBMax.X - (int)p.AABBMin.X / 2;
y = (int)p.AABBMax.Y - (int)p.AABBMin.Y / 2;
}
if (!simulator.TerrainHeightAtPoint(x, y, out height))
{
Logger.Log("Land Patch not stored for location", Helpers.LogLevel.Warning, Client);
return false;
}
Terraform(simulator, localID, west, south, east, north, action, brushSize, seconds, height);
return true;
}
示例2: SaveTerrainStream
private static void SaveTerrainStream(Stream s, Simulator sim)
{
BinaryWriter bs = new BinaryWriter(s);
int y;
for (y = 0; y < 256; y++)
{
int x;
for (x = 0; x < 256; x++)
{
float height;
sim.TerrainHeightAtPoint(x, y, out height);
bs.Write(height);
}
}
bs.Close();
}