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


C# BaseBoat.CanFit方法代码示例

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


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

示例1: RemoveBoat

        public void RemoveBoat(BaseBoat boat)
        {
            if (boat == null)
                return;

            //First, we'll try and put the boat in the cooresponding location where it warped in
            if (boat.Map != null && boat.Map != Map.Internal && m_Altar != null && m_Altar.WarpRegion != null)
            {
                Map map = boat.Map;
                Rectangle2D rec = m_Altar.WarpRegion.Bounds;

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

                Point3D ePnt = new Point3D(rec.X + x, rec.Y + y, -5);

                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 != -5)
                        boat.Z = -5;

                    if (boat.TillerMan != null)
                        boat.TillerManSay(501425); //Ar, turbulent water!
                    return;
                }
            }

            //Plan B, lets kick to some random location who-knows-where
            for (int i = 0; i < 25; i++)
            {
                Rectangle2D rec = CorgulAltar.BoatKickLocation;
                Point3D ePnt = CorgulAltar.GetRandomPoint(rec, Map);

                int offsetX = ePnt.X - boat.X;
                int offsetY = ePnt.Y - boat.Y;
                int offsetZ = ePnt.Z - boat.Z;

                if (boat.CanFit(ePnt, this.Map, boat.ItemID))
                {
                    boat.Teleport(offsetX, offsetY, -5);
                    boat.SendMessageToAllOnBoard("A rough patch of sea has disoriented the crew!");

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

                    if (boat.TillerMan != null)
                        boat.TillerManSay(501425); //Ar, turbulent water!
                    break;
                }
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:60,代码来源:CorgulRegion.cs

示例2: KickBoat

        public bool KickBoat(BaseBoat boat)
        {
            if (boat == null || boat.Deleted)
                return false;

            for (int i = 0; i < 25; i++)
            {
                Rectangle2D rec = m_KickLocs[Utility.Random(m_KickLocs.Length)];

                int x = Utility.RandomMinMax(rec.X, rec.X + rec.Width);
                int y = Utility.RandomMinMax(rec.Y, rec.Y + rec.Height);
                int z = boat.Z;

                Point3D p = new Point3D(x, y, z);

                if (boat.CanFit(p, boat.Map, boat.ItemID))
                {
                    boat.Teleport(x - boat.X, y - boat.Y, z - boat.Z);

                    if (boat.Owner != null && boat.Owner.NetState != null)
                        boat.SendMessageToAllOnBoard(1149785); //A strong tide comes and carries your boat to deeper water.
                    return true;
                }
            }
            return false;
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:26,代码来源:SeaMarket.cs

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