当前位置: 首页>>代码示例>>C#>>正文


C# IScenePresence.Teleport方法代码示例

本文整理汇总了C#中IScenePresence.Teleport方法的典型用法代码示例。如果您正苦于以下问题:C# IScenePresence.Teleport方法的具体用法?C# IScenePresence.Teleport怎么用?C# IScenePresence.Teleport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IScenePresence的用法示例。


在下文中一共展示了IScenePresence.Teleport方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EventManagerOnAvatarEnteringNewParcel

        public void EventManagerOnAvatarEnteringNewParcel(IScenePresence avatar, ILandObject oldParcel)
        {
            if (avatar.CurrentParcel != null)
            {
                //Tell the clint about it
                avatar.CurrentParcel.SendLandUpdateToClient(avatar.ControllingClient);

                //Gotta kill all avatars outside the parcel
                foreach (
                    IScenePresence sp in
                        avatar.Scene.Entities.GetPresences()
                              .Where(sp => sp.UUID != avatar.UUID)
                              .Where(sp => sp.CurrentParcel != null))
                {
                    if (sp.CurrentParcelUUID == avatar.CurrentParcelUUID) //Send full updates for those in the sim
                    {
                        if (avatar.CurrentParcel.LandData.Private || (oldParcel != null && oldParcel.LandData.Private))
                            //Either one, we gotta send an update
                        {
                            sp.SceneViewer.RemoveAvatarFromView(avatar);
                            avatar.SceneViewer.RemoveAvatarFromView(sp);
                            sp.SceneViewer.QueuePresenceForFullUpdate(avatar, true);
                            avatar.SceneViewer.QueuePresenceForFullUpdate(sp, true);
                        }
                    }
                    else //Kill those outside the parcel
                    {
                        if (sp.CurrentParcel.LandData.Private || avatar.CurrentParcel.LandData.Private)
                        {
                            sp.ControllingClient.SendKillObject(sp.Scene.RegionInfo.RegionHandle,
                                                                new IEntity[1] {avatar});
                            avatar.ControllingClient.SendKillObject(sp.Scene.RegionInfo.RegionHandle,
                                                                    new IEntity[1] {sp});
                            sp.SceneViewer.RemoveAvatarFromView(avatar);
                            avatar.SceneViewer.RemoveAvatarFromView(sp);
                        }
                    }
                }

                if (UseDwell)
                    avatar.CurrentParcel.LandData.Dwell += 1;
                if (avatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HEIGHT)
                {
                    if (avatar.CurrentParcel.IsBannedFromLand(avatar.UUID))
                    {
                        SendYouAreBannedNotice(avatar);
                        Vector3 pos = GetNearestAllowedPosition(avatar);
                        pos.Z -= avatar.PhysicsActor.Size.Z;
                        avatar.Teleport(pos);
                    }
                    else if (avatar.CurrentParcel.IsRestrictedFromLand(avatar.UUID))
                    {
                        SendYouAreRestrictedNotice(avatar);
                        Vector3 pos = GetNearestAllowedPosition(avatar);
                        pos.Z -= avatar.PhysicsActor.Size.Z;
                        avatar.Teleport(pos);
                    }
                }
            }
        }
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:60,代码来源:ParcelManagementModule.cs

示例2: Teleport

        public virtual void Teleport(IScenePresence sp, GridRegion finalDestination, Vector3 position, Vector3 lookAt,
            uint teleportFlags)
        {
            sp.ControllingClient.SendTeleportStart(teleportFlags);
            sp.ControllingClient.SendTeleportProgress(teleportFlags, "requesting");

            // Reset animations; the viewer does that in teleports.
            if (sp.Animator != null)
                sp.Animator.ResetAnimations();

            try
            {
                string reason = "";
                if (finalDestination.RegionHandle == sp.Scene.RegionInfo.RegionHandle)
                {
                    //First check whether the user is allowed to move at all
                    if (!sp.Scene.Permissions.AllowedOutgoingLocalTeleport(sp.UUID, out reason))
                    {
                        sp.ControllingClient.SendTeleportFailed(reason);
                        return;
                    }
                    //Now respect things like parcel bans with this
                    if (
                        !sp.Scene.Permissions.AllowedIncomingTeleport(sp.UUID, position, teleportFlags, out position,
                                                                      out reason))
                    {
                        sp.ControllingClient.SendTeleportFailed(reason);
                        return;
                    }
                    MainConsole.Instance.DebugFormat(
                        "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}",
                        position, sp.Scene.RegionInfo.RegionName);

                    sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
                    sp.RequestModuleInterface<IScriptControllerModule>()
                      .HandleForceReleaseControls(sp.ControllingClient, sp.UUID);
                    sp.Teleport(position);
                }
                else // Another region possibly in another simulator
                {
                    // Make sure the user is allowed to leave this region
                    if (!sp.Scene.Permissions.AllowedOutgoingRemoteTeleport(sp.UUID, out reason))
                    {
                        sp.ControllingClient.SendTeleportFailed(reason);
                        return;
                    }

                    DoTeleport(sp, finalDestination, position, lookAt, teleportFlags);
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.ErrorFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0}\n{1}", e.Message,
                                                 e.StackTrace);
                sp.ControllingClient.SendTeleportFailed("Internal error");
            }
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:57,代码来源:EntityTransferModule.cs

示例3: EventManagerOnAvatarEnteringNewParcel

        public void EventManagerOnAvatarEnteringNewParcel (IScenePresence avatar, int localLandID, UUID regionID)
        {
            if (m_scene.RegionInfo.RegionID == regionID)
            {
                ILandObject parcelAvatarIsEntering = GetLandObject(localLandID);

                if (parcelAvatarIsEntering != null)
                {
                    //Tell the clint about it
                    parcelAvatarIsEntering.SendLandUpdateToClient(avatar.ControllingClient);
                    
                    if (UseDwell)
                        parcelAvatarIsEntering.LandData.Dwell += 1;
                    if (avatar.AbsolutePosition.Z < ParcelManagementModule.BAN_LINE_SAFETY_HEIGHT)
                    {
                        if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID))
                        {
                            SendYouAreBannedNotice(avatar);
                            Vector3 pos = GetNearestAllowedPosition(avatar);
                            avatar.Teleport(pos);
                        }
                        else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID))
                        {
                            SendYouAreRestrictedNotice(avatar);
                            Vector3 pos = GetNearestAllowedPosition(avatar);
                            avatar.Teleport(pos);
                        }
                    }
                }
            }
        }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:31,代码来源:ParcelManagementModule.cs

示例4: Teleport

        public virtual void Teleport(IScenePresence sp, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags)
        {
            sp.ControllingClient.SendTeleportStart(teleportFlags);
            sp.ControllingClient.SendTeleportProgress(teleportFlags, "requesting");

            // Reset animations; the viewer does that in teleports.
            if(sp.Animator != null)
                sp.Animator.ResetAnimations();

            try
            {
                string reason = "";
                if (finalDestination.RegionHandle == sp.Scene.RegionInfo.RegionHandle)
                {
                    //First check whether the user is allowed to move at all
                    if (!sp.Scene.Permissions.AllowedOutgoingLocalTeleport(sp.UUID, out reason))
                    {
                        sp.ControllingClient.SendTeleportFailed(reason);
                        return;
                    }
                    //Now respect things like parcel bans with this
                    if (!sp.Scene.Permissions.AllowedIncomingTeleport(sp.UUID, position, teleportFlags, out position, out reason))
                    {
                        sp.ControllingClient.SendTeleportFailed(reason);
                        return;
                    }
                    MainConsole.Instance.DebugFormat(
                        "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation {0} within {1}",
                        position, sp.Scene.RegionInfo.RegionName);

                    sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
                    sp.Teleport(position);
                }
                else // Another region possibly in another simulator
                {
                    // Make sure the user is allowed to leave this region
                    if (!sp.Scene.Permissions.AllowedOutgoingRemoteTeleport(sp.UUID, out reason))
                    {
                        sp.ControllingClient.SendTeleportFailed(reason);
                        return;
                    }
                    //MainConsole.Instance.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}",
                    //    finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID);

                    // Check that these are not the same coordinates
                    if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
                        finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY)
                    {
                        // Can't do. Viewer crashes
                        sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again.");
                        return;
                    }

                    //
                    // This is it
                    //
                    DoTeleport(sp, finalDestination, position, lookAt, teleportFlags);
                    //
                    //
                    //
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.ErrorFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0}\n{1}", e.Message, e.StackTrace);
                sp.ControllingClient.SendTeleportFailed("Internal error");
            }
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:68,代码来源:EntityTransferModule.cs

示例5: EventManagerOnAvatarEnteringNewParcel

        public void EventManagerOnAvatarEnteringNewParcel (IScenePresence avatar, int localLandID, UUID regionID)
        {
            if (m_scene.RegionInfo.RegionID == regionID)
            {
                if (avatar.CurrentParcel != null)
                {
                    //Tell the clint about it
                    avatar.CurrentParcel.SendLandUpdateToClient (avatar.ControllingClient);

                    if (avatar.CurrentParcel.LandData.Private)
                    {
                        //Gotta kill all avatars outside the parcel
                        foreach (IScenePresence sp in avatar.Scene.Entities.GetPresences ())
                        {
                            if (sp.UUID == avatar.UUID)
                                continue;
                            if (sp.CurrentParcelUUID == avatar.CurrentParcelUUID)//Send full updates for those in the sim
                                sp.SceneViewer.QueuePresenceForFullUpdate (avatar);
                            else//Kill those outside the parcel
                                sp.ControllingClient.SendKillObject (sp.Scene.RegionInfo.RegionHandle, 
                                    new IEntity[1] { avatar });
                        }
                    }
                    
                    if (UseDwell)
                        avatar.CurrentParcel.LandData.Dwell += 1;
                    if (avatar.AbsolutePosition.Z < ParcelManagementModule.BAN_LINE_SAFETY_HEIGHT)
                    {
                        if (avatar.CurrentParcel.IsBannedFromLand (avatar.UUID))
                        {
                            SendYouAreBannedNotice(avatar);
                            Vector3 pos = GetNearestAllowedPosition(avatar);
                            avatar.Teleport(pos);
                        }
                        else if (avatar.CurrentParcel.IsRestrictedFromLand (avatar.UUID))
                        {
                            SendYouAreRestrictedNotice(avatar);
                            Vector3 pos = GetNearestAllowedPosition(avatar);
                            avatar.Teleport(pos);
                        }
                    }
                }
            }
        }
开发者ID:LOG123,项目名称:Aurora-Sim-PhysX,代码行数:44,代码来源:ParcelManagementModule.cs


注:本文中的IScenePresence.Teleport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。