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


C# IScene.TryGetScenePresence方法代码示例

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


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

示例1: AllowedTeleports

 private bool AllowedTeleports(UUID userID, IScene scene, out string reason)
 {
     //Make sure that agents that are in combat cannot tp around. They CAN tp if they are out of combat however
     reason = "";
     IScenePresence SP = null;
     if (scene.TryGetScenePresence(userID, out SP))
         if (DisallowTeleportingForCombatants &&
             SP.RequestModuleInterface<ICombatPresence>() != null &&
             !SP.RequestModuleInterface<ICombatPresence>().HasLeftCombat && !SP.Invulnerable)
             return false;
     return true;
 }
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:12,代码来源:CombatModule.cs

示例2: OnAllowedIncomingTeleport


//.........这里部分代码省略.........
            {
                if (!scene.Permissions.IsGod(userID))
                {
                    Telehub telehub = RegionConnector.FindTelehub(scene.RegionInfo.RegionID, scene.RegionInfo.RegionHandle);
                    if (telehub != null)
                    {
                        if (telehub.SpawnPos.Count == 0)
                        {
                            Position = new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ);
                        }
                        else
                        {
                            int LastTelehubNum = 0;
                            if (!LastTelehub.TryGetValue(scene.RegionInfo.RegionID, out LastTelehubNum))
                                LastTelehubNum = 0;
                            Position = telehub.SpawnPos[LastTelehubNum] + new Vector3(telehub.TelehubLocX, telehub.TelehubLocY, telehub.TelehubLocZ);
                            LastTelehubNum++;
                            if (LastTelehubNum == telehub.SpawnPos.Count)
                                LastTelehubNum = 0;
                            LastTelehub[scene.RegionInfo.RegionID] = LastTelehubNum;
                        }
                    }
                }
            }
            if (!scene.Permissions.GenericParcelPermission(userID, ILO, (ulong)GroupPowers.None))
            {
                if (ILO.LandData.LandingType == 2) //Blocked, force this person off this land
                {
                    //Find a new parcel for them
                    List<ILandObject> Parcels = parcelManagement.ParcelsNearPoint(Position);
                    if (Parcels.Count == 0)
                    {
                        IScenePresence SP;
                        scene.TryGetScenePresence(userID, out SP);
                        newPosition = parcelManagement.GetNearestRegionEdgePosition(SP);
                    }
                    else
                    {
                        bool found = false;
                        //We need to check here as well for bans, can't toss someone into a parcel they are banned from
                        foreach (ILandObject Parcel in Parcels)
                        {
                            if (!Parcel.IsBannedFromLand(userID))
                            {
                                //Now we have to check their userloc
                                if (ILO.LandData.LandingType == 2)
                                    continue; //Blocked, check next one
                                else if (ILO.LandData.LandingType == 1) //Use their landing spot
                                    newPosition = Parcel.LandData.UserLocation;
                                else //They allow for anywhere, so dump them in the center at the ground
                                    newPosition = parcelManagement.GetParcelCenterAtGround(Parcel);
                                found = true;
                            }
                        }
                        if (!found) //Dump them at the edge
                        {
                            if (Sp != null)
                                newPosition = parcelManagement.GetNearestRegionEdgePosition(Sp);
                            else
                            {
                                reason = "Banned from this parcel.";
                                return true;
                            }
                        }
                    }
                }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:67,代码来源:EstateService.cs


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