當前位置: 首頁>>代碼示例>>C#>>正文


C# BaseBoat.GetObjectsOnBoard方法代碼示例

本文整理匯總了C#中Server.Multis.BaseBoat.GetObjectsOnBoard方法的典型用法代碼示例。如果您正苦於以下問題:C# BaseBoat.GetObjectsOnBoard方法的具體用法?C# BaseBoat.GetObjectsOnBoard怎麽用?C# BaseBoat.GetObjectsOnBoard使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Multis.BaseBoat的用法示例。


在下文中一共展示了BaseBoat.GetObjectsOnBoard方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CheckEnter

        public void CheckEnter(BaseBoat boat)
        {
            if (boat == null || this.Map == null || this.Map == Map.Internal)
                return;

            //Do not enter corgul region if we aren't in this region anymore
            Region r = Region.Find(boat.Location, boat.Map);
            if (r != null && !r.IsPartOf(this))
                return;

            Map map = this.Map;
            List<ISpawnable> list = boat.GetObjectsOnBoard();
            List<PlayerMobile> pms = new List<PlayerMobile>();
            bool hasMap = false;

            foreach (ISpawnable i in list)
            {
                if (i is PlayerMobile && ((PlayerMobile)i).NetState != null)
                {
                    pms.Add((PlayerMobile)i);
                    PlayerMobile pm = (PlayerMobile)i;

                    if (pm.Backpack == null)
                        continue;

                    Item item = pm.Backpack.FindItemByType(typeof(CorgulIslandMap));
                    if (item != null && item is CorgulIslandMap && this.Contains(((CorgulIslandMap)item).DestinationPoint))
                    {
                        hasMap = true;
                        break;
                    }
                }
            }

            if (hasMap)
            {
                int x = boat.X - m_Bounds.X;
                int y = boat.Y - m_Bounds.Y;
                int z = map.GetAverageZ(x, y);

                Point3D ePnt = new Point3D(CorgulAltar.CorgulBounds.X + x, CorgulAltar.CorgulBounds.Y + y, 0);

                int offsetX = ePnt.X - boat.X;
                int offsetY = ePnt.Y - boat.Y;
                int offsetZ = map.GetAverageZ(ePnt.X, ePnt.Y) - boat.Z;

                if (boat.CanFit(ePnt, this.Map, boat.ItemID))
                {
                    boat.Teleport(offsetX, offsetY, offsetZ);

                    //int z = this.Map.GetAverageZ(boat.X, boat.Y);
                    if (boat.Z != 0)
                        boat.Z = 0;

                    if (boat.TillerMan != null)
                        boat.TillerManSay(501425); //Ar, turbulent water!
                }
                else
                {
                    boat.StopMove(true);
                    boat.SendMessageToAllOnBoard("The boat has struck a coral reef!");
                }

            }
        }
開發者ID:Crome696,項目名稱:ServUO,代碼行數:65,代碼來源:WarpRegion.cs


注:本文中的Server.Multis.BaseBoat.GetObjectsOnBoard方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。