本文整理汇总了C#中ISceneEntity.RemoveScriptInstances方法的典型用法代码示例。如果您正苦于以下问题:C# ISceneEntity.RemoveScriptInstances方法的具体用法?C# ISceneEntity.RemoveScriptInstances怎么用?C# ISceneEntity.RemoveScriptInstances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISceneEntity
的用法示例。
在下文中一共展示了ISceneEntity.RemoveScriptInstances方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteSceneObject
/// <summary>
/// Synchronously delete the given object from the scene.
/// </summary>
/// <param name="group">Object Id</param>
/// <param name="DeleteScripts">Remove the scripts from the ScriptEngine as well</param>
/// <param name="removeFromDatabase">Remove from the database?</param>
protected bool DeleteSceneObject(ISceneEntity group, bool DeleteScripts, bool removeFromDatabase)
{
//MainConsole.Instance.DebugFormat("[Backup]: Deleting scene object {0} {1}", group.Name, group.UUID);
if (group.SitTargetAvatar.Count != 0)
{
foreach (UUID avID in group.SitTargetAvatar)
{
//Don't screw up avatar's that are sitting on us!
IScenePresence SP = m_scene.GetScenePresence(avID);
if (SP != null)
SP.StandUp();
}
}
// Serialise calls to RemoveScriptInstances to avoid
// deadlocking on m_parts inside SceneObjectGroup
if (DeleteScripts)
{
group.RemoveScriptInstances(true);
}
foreach (ISceneChildEntity part in group.ChildrenEntities())
{
IScriptControllerModule m = m_scene.RequestModuleInterface<IScriptControllerModule>();
if (m != null)
m.RemoveAllScriptControllers(part);
}
if (group.RootChild.PhysActor != null)
{
//Remove us from the physics sim
m_scene.PhysicsScene.DeletePrim(group.RootChild.PhysActor);
group.RootChild.PhysActor = null;
}
if (!group.IsAttachment)
m_scene.SimulationDataService.Tainted();
if (m_scene.SceneGraph.DeleteEntity(group))
{
// We need to keep track of this state in case this group is still queued for backup.
group.IsDeleted = true;
m_scene.EventManager.TriggerObjectBeingRemovedFromScene(group);
return true;
}
//MainConsole.Instance.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
return false;
}
示例2: DeleteSceneObject
/// <summary>
/// Synchronously delete the given object from the scene.
/// </summary>
/// <param name="group">Object Id</param>
/// <param name="DeleteScripts">Remove the scripts from the ScriptEngine as well</param>
/// <param name="removeFromDatabase">Remove from the database?</param>
protected bool DeleteSceneObject(ISceneEntity group, bool DeleteScripts, bool removeFromDatabase)
{
//m_log.DebugFormat("[Backup]: Deleting scene object {0} {1}", group.Name, group.UUID);
lock (group.SitTargetAvatar)
{
if (group.SitTargetAvatar.Count != 0)
{
UUID[] ids = new UUID[group.SitTargetAvatar.Count];
group.SitTargetAvatar.CopyTo(ids);
foreach (UUID avID in ids)
{
//Don't screw up avatar's that are sitting on us!
IScenePresence SP = m_scene.GetScenePresence(avID);
if (SP != null)
SP.StandUp();
}
}
}
// Serialise calls to RemoveScriptInstances to avoid
// deadlocking on m_parts inside SceneObjectGroup
if (DeleteScripts)
{
group.RemoveScriptInstances(true);
}
foreach (ISceneChildEntity part in group.ChildrenEntities())
{
IScriptControllerModule m = m_scene.RequestModuleInterface<IScriptControllerModule>();
if(m != null)
m.RemoveAllScriptControllers(part);
if (part.PhysActor != null)
{
//Remove us from the physics sim
m_scene.PhysicsScene.RemovePrim(part.PhysActor);
//We MUST leave this to the PhysicsScene or it will hate us forever!
//part.PhysActor = null;
}
}
m_scene.SimulationDataService.Tainted ();
if (m_scene.SceneGraph.DeleteEntity(group))
{
// We need to keep track of this state in case this group is still queued for backup.
group.IsDeleted = true;
//Clear the update schedule HERE so that IsDeleted will not have to fire as well
foreach (ISceneChildEntity part in group.ChildrenEntities ())
{
//Make sure it isn't going to be updated again
part.ClearUpdateSchedule ();
}
m_scene.EventManager.TriggerObjectBeingRemovedFromScene(group);
return true;
}
//m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
return false;
}