本文整理汇总了C#中OpenSim.Region.Framework.Scenes.Scene.TestBorderCross方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.TestBorderCross方法的具体用法?C# Scene.TestBorderCross怎么用?C# Scene.TestBorderCross使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.Scene
的用法示例。
在下文中一共展示了Scene.TestBorderCross方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsOutsideRegion
protected virtual bool IsOutsideRegion(Scene s, Vector3 pos)
{
if (s.TestBorderCross(pos, Cardinals.N))
return true;
if (s.TestBorderCross(pos, Cardinals.S))
return true;
if (s.TestBorderCross(pos, Cardinals.E))
return true;
if (s.TestBorderCross(pos, Cardinals.W))
return true;
return false;
}
示例2: GetDestination
public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos)
{
version = String.Empty;
newpos = new Vector3(pos.X, pos.Y, pos.Z);
// m_log.DebugFormat(
// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
uint neighbourx = scene.RegionInfo.RegionLocX;
uint neighboury = scene.RegionInfo.RegionLocY;
const float boundaryDistance = 1.7f;
Vector3 northCross = new Vector3(0, boundaryDistance, 0);
Vector3 southCross = new Vector3(0, -1 * boundaryDistance, 0);
Vector3 eastCross = new Vector3(boundaryDistance, 0, 0);
Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0);
// distance into new region to place avatar
const float enterDistance = 0.5f;
if (scene.TestBorderCross(pos + westCross, Cardinals.W))
{
if (scene.TestBorderCross(pos + northCross, Cardinals.N))
{
Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
}
else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
{
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
neighbourx--;
newpos.X = Constants.RegionSize - enterDistance;
}
else if (scene.TestBorderCross(pos + eastCross, Cardinals.E))
{
Border b = scene.GetCrossedBorder(pos + eastCross, Cardinals.E);
neighbourx += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
newpos.X = enterDistance;
if (scene.TestBorderCross(pos + southCross, Cardinals.S))
{
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
{
Border c = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize);
newpos.Y = enterDistance;
}
}
else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
{
Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
{
Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
newpos.Y = enterDistance;
}
/*
if (pos.X < boundaryDistance) //West
{
neighbourx--;
newpos.X = Constants.RegionSize - enterDistance;
}
else if (pos.X > Constants.RegionSize - boundaryDistance) // East
{
neighbourx++;
newpos.X = enterDistance;
}
if (pos.Y < boundaryDistance) // South
{
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
else if (pos.Y > Constants.RegionSize - boundaryDistance) // North
{
neighboury++;
newpos.Y = enterDistance;
}
*/
xDest = neighbourx;
yDest = neighboury;
int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize);
ulong neighbourHandle = Utils.UIntsToLong((uint)x, (uint)y);
ExpiringCache<ulong, DateTime> r;
DateTime banUntil;
//.........这里部分代码省略.........
示例3: CrossAgentToNewRegion
public void CrossAgentToNewRegion(Scene scene, ScenePresence agent, bool isFlying)
{
Vector3 pos = agent.AbsolutePosition;
Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z);
uint neighbourx = m_regionInfo.RegionLocX;
uint neighboury = m_regionInfo.RegionLocY;
const float boundaryDistance = 1.7f;
Vector3 northCross = new Vector3(0,boundaryDistance, 0);
Vector3 southCross = new Vector3(0, -1 * boundaryDistance, 0);
Vector3 eastCross = new Vector3(boundaryDistance, 0, 0);
Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0);
// distance to edge that will trigger crossing
// distance into new region to place avatar
const float enterDistance = 0.5f;
if (scene.TestBorderCross(pos + westCross, Cardinals.W))
{
if (scene.TestBorderCross(pos + northCross, Cardinals.N))
{
Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
}
else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
{
Border b = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
if (b.TriggerRegionX == 0 && b.TriggerRegionY == 0)
{
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
else
{
neighboury = b.TriggerRegionY;
neighbourx = b.TriggerRegionX;
Vector3 newposition = pos;
newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
agent.ControllingClient.SendAgentAlertMessage(
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
return;
}
}
Border ba = scene.GetCrossedBorder(pos + westCross, Cardinals.W);
if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0)
{
neighbourx--;
newpos.X = Constants.RegionSize - enterDistance;
}
else
{
neighboury = ba.TriggerRegionY;
neighbourx = ba.TriggerRegionX;
Vector3 newposition = pos;
newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
agent.ControllingClient.SendAgentAlertMessage(
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
return;
}
}
else if (scene.TestBorderCross(pos + eastCross, Cardinals.E))
{
Border b = scene.GetCrossedBorder(pos + eastCross, Cardinals.E);
neighbourx += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
newpos.X = enterDistance;
if (scene.TestBorderCross(pos + southCross, Cardinals.S))
{
Border ba = scene.GetCrossedBorder(pos + southCross, Cardinals.S);
if (ba.TriggerRegionX == 0 && ba.TriggerRegionY == 0)
{
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
else
{
neighboury = ba.TriggerRegionY;
neighbourx = ba.TriggerRegionX;
Vector3 newposition = pos;
newposition.X += (scene.RegionInfo.RegionLocX - neighbourx) * Constants.RegionSize;
newposition.Y += (scene.RegionInfo.RegionLocY - neighboury) * Constants.RegionSize;
agent.ControllingClient.SendAgentAlertMessage(
String.Format("Moving you to region {0},{1}", neighbourx, neighboury), false);
InformClientToInitateTeleportToLocation(agent, neighbourx, neighboury, newposition, scene);
return;
}
}
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
//.........这里部分代码省略.........
示例4: CrossAgentToNewRegion
public void CrossAgentToNewRegion(Scene scene, ScenePresence agent, bool isFlying)
{
Vector3 pos = agent.AbsolutePosition;
Vector3 newpos = new Vector3(pos.X, pos.Y, pos.Z);
uint neighbourx = m_regionInfo.RegionLocX;
uint neighboury = m_regionInfo.RegionLocY;
const float boundaryDistance = 1.7f;
Vector3 northCross = new Vector3(0,boundaryDistance, 0);
Vector3 southCross = new Vector3(0, -1 * boundaryDistance, 0);
Vector3 eastCross = new Vector3(boundaryDistance, 0, 0);
Vector3 westCross = new Vector3(-1 * boundaryDistance, 0, 0);
// distance to edge that will trigger crossing
// distance into new region to place avatar
const float enterDistance = 0.5f;
if (scene.TestBorderCross(pos + westCross, Cardinals.W))
{
if (scene.TestBorderCross(pos + northCross, Cardinals.N))
{
Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
neighboury += (uint)(int)(b.BorderLine.Z/(int)Constants.RegionSize);
}
else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
{
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
neighbourx--;
newpos.X = Constants.RegionSize - enterDistance;
}
else if (scene.TestBorderCross(pos + eastCross, Cardinals.E))
{
Border b = scene.GetCrossedBorder(pos + eastCross, Cardinals.E);
neighbourx += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
newpos.X = enterDistance;
if (scene.TestBorderCross(pos + southCross, Cardinals.S))
{
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
{
Border c = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
neighboury += (uint)(int)(c.BorderLine.Z / (int)Constants.RegionSize);
newpos.Y = enterDistance;
}
}
else if (scene.TestBorderCross(pos + southCross, Cardinals.S))
{
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
else if (scene.TestBorderCross(pos + northCross, Cardinals.N))
{
Border b = scene.GetCrossedBorder(pos + northCross, Cardinals.N);
neighboury += (uint)(int)(b.BorderLine.Z / (int)Constants.RegionSize);
newpos.Y = enterDistance;
}
/*
if (pos.X < boundaryDistance) //West
{
neighbourx--;
newpos.X = Constants.RegionSize - enterDistance;
}
else if (pos.X > Constants.RegionSize - boundaryDistance) // East
{
neighbourx++;
newpos.X = enterDistance;
}
if (pos.Y < boundaryDistance) // South
{
neighboury--;
newpos.Y = Constants.RegionSize - enterDistance;
}
else if (pos.Y > Constants.RegionSize - boundaryDistance) // North
{
neighboury++;
newpos.Y = enterDistance;
}
*/
CrossAgentToNewRegionDelegate d = CrossAgentToNewRegionAsync;
d.BeginInvoke(agent, newpos, neighbourx, neighboury, isFlying, CrossAgentToNewRegionCompleted, d);
}