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


C# BaseBoat.GetMovingEntities方法代碼示例

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


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

示例1: DockBoat

        public void DockBoat(BaseBoat boat, BaseHouse house)
        {
            List<ISpawnable> list = boat.GetMovingEntities();

            foreach (ISpawnable o in list)
            {
                if (!(o is Item) || o == this || boat.IsComponentItem(o) || o is EffectItem || o == boat.TillerMan)
                    continue;

                Item item = o as Item;

                if (!item.Deleted && boat.Contains(item))
                {
                    if (item is AddonComponent || item is BaseAddon)
                    {
                        BaseAddon addon = item is AddonComponent ? ((AddonComponent)item).Addon : (BaseAddon)item;
                        Item deed = addon.Deed;

                        bool retainDeedHue = false;
                        int hue = 0;

                        if (addon != null && addon.RetainDeedHue)
                        {
                            retainDeedHue = true;

                            for (int j = 0; hue == 0 && j < addon.Components.Count; ++j)
                            {
                                AddonComponent c = addon.Components[j];

                                if (c.Hue != 0)
                                    hue = c.Hue;
                            }
                        }

                        if (deed != null)
                        {
                            if (retainDeedHue)
                                deed.Hue = hue;

                            house.DropToMovingCrate(deed);
                        }
                    }
                    else
                    {
                        item.Delete();
                    }
                }

                Container cont;

                if (boat is BaseGalleon)
                    cont = ((BaseGalleon)boat).GalleonHold;
                else
                    cont = boat.Hold;

                if (cont != null)
                {
                    cont.Items.ForEach(i =>
                        {
                            if (i is BaseWeapon)
                                house.DropToMovingCrate(i);
                            else
                                i.Delete();
                        });
                }
            }

            BaseDockedBoat model = boat.BoatItem;

            if (model == null || model.Deleted)
                model = boat.DockedBoat;

            if (model == null)
                return;

            model.BoatItem = boat;

            if (boat.IsClassicBoat && boat.Owner != null)
                boat.RemoveKeys(boat.Owner);

            house.DropToMovingCrate(model);

            boat.OnDryDock();

            boat.Refresh();
            boat.Internalize();

            list.Clear();
            list.TrimExcess();
        }
開發者ID:Crome696,項目名稱:ServUO,代碼行數:90,代碼來源:LighthouseAddon.cs

示例2: DisplayBoatHS

            public DisplayBoatHS(Mobile beholder, BaseBoat boat)
                : base(0xF7)
            {
                List<IEntity> ents = boat.GetMovingEntities();

                SafeAdd(boat.TillerMan, ents);
                SafeAdd(boat.Hold, ents);
                SafeAdd(boat.PPlank, ents);
                SafeAdd(boat.SPlank, ents);
                foreach (BoatComponent component in boat.BoatComponents)
                {
                    SafeAdd(component, ents);
                }

                ents.Add(boat);

                EnsureCapacity(3 + 2 + ents.Count * 26);

                m_Stream.Write((short)0); // count placeholder

                int count = 0;

                foreach (IEntity ent in ents)
                {
                    if (!beholder.CanSee(ent))
                        continue;

                    // Embedded WorldItemHS packets
                    m_Stream.Write((byte)0xF3);
                    m_Stream.Write((short)0x1);

                    if (ent is BaseMulti)
                    {
                        BaseMulti bm = (BaseMulti)ent;

                        m_Stream.Write((byte)0x02);
                        m_Stream.Write((int)bm.Serial);
                        // TODO: Mask no longer needed, merge with Item case?
                        m_Stream.Write((ushort)(bm.ItemID & 0x3FFF));
                        m_Stream.Write((byte)0);

                        m_Stream.Write((short)bm.Amount);
                        m_Stream.Write((short)bm.Amount);

                        m_Stream.Write((short)(bm.X & 0x7FFF));
                        m_Stream.Write((short)(bm.Y & 0x3FFF));
                        m_Stream.Write((sbyte)bm.Z);

                        m_Stream.Write((byte)bm.Light);
                        m_Stream.Write((short)bm.Hue);
                        m_Stream.Write((byte)bm.GetPacketFlags());
                    }
                    else if (ent is Mobile)
                    {
                        Mobile m = (Mobile)ent;

                        m_Stream.Write((byte)0x01);
                        m_Stream.Write((int)m.Serial);
                        m_Stream.Write((short)m.Body);
                        m_Stream.Write((byte)0);

                        m_Stream.Write((short)1);
                        m_Stream.Write((short)1);

                        m_Stream.Write((short)(m.X & 0x7FFF));
                        m_Stream.Write((short)(m.Y & 0x3FFF));
                        m_Stream.Write((sbyte)m.Z);

                        m_Stream.Write((byte)m.Direction);
                        m_Stream.Write((short)m.Hue);
                        m_Stream.Write((byte)m.GetPacketFlags());
                    }
                    else if (ent is Item)
                    {
                        Item item = (Item)ent;

                        m_Stream.Write((byte)0x00);
                        m_Stream.Write((int)item.Serial);
                        m_Stream.Write((ushort)(item.ItemID & 0xFFFF));
                        m_Stream.Write((byte)0);

                        m_Stream.Write((short)item.Amount);
                        m_Stream.Write((short)item.Amount);

                        m_Stream.Write((short)(item.X & 0x7FFF));
                        m_Stream.Write((short)(item.Y & 0x3FFF));
                        m_Stream.Write((sbyte)item.Z);

                        m_Stream.Write((byte)item.Light);
                        m_Stream.Write((short)item.Hue);
                        m_Stream.Write((byte)item.GetPacketFlags());
                    }

                    m_Stream.Write((short)0x00);
                    ++count;
                }

                m_Stream.Seek(3, System.IO.SeekOrigin.Begin);
                m_Stream.Write((short)count);
            }
開發者ID:greeduomacro,項目名稱:UO-Forever,代碼行數:100,代碼來源:BaseBoat.cs

示例3: BOATMOBILES

			public static ArrayList BOATMOBILES(TriggerObject trigObject, BaseBoat boat, bool deadOnly)
			{
				return boat != null
						   ? new ArrayList(boat.GetMovingEntities().OfType<Mobile>().Where(m => !deadOnly || !m.Alive).ToArray())
						   : new ArrayList();
			}
開發者ID:greeduomacro,項目名稱:UO-Forever,代碼行數:6,代碼來源:UberScriptFunctions.cs

示例4: INBOAT

			public static bool INBOAT(TriggerObject trigObject, BaseBoat boat, IEntity testEntity)
			{
				return boat != null && boat.GetMovingEntities().Any(entity => entity == testEntity);
			}
開發者ID:greeduomacro,項目名稱:UO-Forever,代碼行數:4,代碼來源:UberScriptFunctions.cs

示例5: DisplayBoatHS

            public DisplayBoatHS(BaseBoat boat) : base(0xF7)
            {
                List<ISpawnable> ents = boat.GetMovingEntities();

                EnsureCapacity(5 + ents.Count * 26);
                m_Stream.Write((short)ents.Count);

                new WorldItemHS(boat, m_Stream);

                for (int i = 0; i < ents.Count; i++)
                {
                    if (ents[i] is Item)
                        new WorldItemHS((Item)ents[i], m_Stream);
                    else if (ents[i] is Mobile)
                        new WorldItemHS((Mobile)ents[i], m_Stream);
                }
            }
開發者ID:Crome696,項目名稱:ServUO,代碼行數:17,代碼來源:BaseBoat.cs


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