本文整理汇总了C#中OpenSim.Region.Framework.Scenes.ScenePresence.IsAtTarget方法的典型用法代码示例。如果您正苦于以下问题:C# ScenePresence.IsAtTarget方法的具体用法?C# ScenePresence.IsAtTarget怎么用?C# ScenePresence.IsAtTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.ScenePresence
的用法示例。
在下文中一共展示了ScenePresence.IsAtTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNextPosition
public bool GetNextPosition(ScenePresence scenePresence, float closeToRange, TimeSpan diffFromLastFrame, float secondsBeforeForcedTeleport,
out Vector3 position, out TravelMode state, out bool needsToTeleportToPosition, out bool changingNodes)
{
changingNodes = false;
lock (m_lock)
{
while(true)
{
//Initialize default values
position = Vector3.Zero;
state = TravelMode.None;
needsToTeleportToPosition = false;
//See if we have a valid position to attempt to move to
if(CurrentPos < m_listOfPositions.Count)
{
//Get the position/state and make sure that it is within the region
position = m_listOfPositions[CurrentPos];
Util.ForceValidRegionXYZ(ref position);
state = m_listOfStates[CurrentPos];
if (state == TravelMode.Wait)
{
if (!m_waitingSince.HasValue)//Has no value, so we're just starting to wait
m_waitingSince = DateTime.Now;
else
{
double ms = (DateTime.Now - m_waitingSince.Value).TotalMilliseconds;
if (ms > (position.X * 1000f))
{
//We're done waiting, increment the position counter and go around the loop again
m_waitingSince = null;
CurrentPos++;
changingNodes = true;
m_timeSinceLastChangedPosition = TimeSpan.FromMilliseconds(0);
continue;
}
}
return true;
}
else
{
//We are attempting to move somewhere
if (scenePresence.IsAtTarget(position, closeToRange))
{
//We made it to the position, begin proceeding towards the next position
CurrentPos++;
changingNodes = true;
m_timeSinceLastChangedPosition = TimeSpan.FromMilliseconds(0);
continue;
}
else
{
m_timeSinceLastChangedPosition = m_timeSinceLastChangedPosition.Add(diffFromLastFrame);
//We need to see if we should teleport to the next node rather than waiting for us to get there
if (m_timeSinceLastChangedPosition.TotalMilliseconds > (secondsBeforeForcedTeleport * 1000))
{
changingNodes = true;
m_timeSinceLastChangedPosition = TimeSpan.FromMilliseconds(0);
needsToTeleportToPosition = true;
}
}
return true;
}
}
else
{
//We've finished all the states in the position list
m_timeSinceLastChangedPosition = TimeSpan.FromMilliseconds(0);
if (m_listOfPositions.Count == 0)//Sanity check
return false;
if (FollowIndefinitely)
{
//If we're following indefinitely, then the counter is reset to the beginning and we go around again
CurrentPos = 0;
changingNodes = true;
continue;
}
return false;
}
}
}
}