本文整理汇总了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();
}
示例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);
}
示例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();
}
示例4: INBOAT
public static bool INBOAT(TriggerObject trigObject, BaseBoat boat, IEntity testEntity)
{
return boat != null && boat.GetMovingEntities().Any(entity => entity == testEntity);
}
示例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);
}
}