本文整理匯總了C#中WCell.RealmServer.Entities.WorldObject.AddMessage方法的典型用法代碼示例。如果您正苦於以下問題:C# WorldObject.AddMessage方法的具體用法?C# WorldObject.AddMessage怎麽用?C# WorldObject.AddMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WCell.RealmServer.Entities.WorldObject
的用法示例。
在下文中一共展示了WorldObject.AddMessage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Apply
protected override void Apply(WorldObject target)
{
if (Effect.Spell.IsHearthStoneSpell && m_cast.CasterChar != null)
{
// teleport back home
var pos = m_cast.CasterChar.BindLocation;
target.AddMessage(() => ((Unit)target).TeleportTo(pos));
}
else
{
if (Effect.ImplicitTargetB == ImplicitSpellTargetType.BehindTargetLocation)
{
var unit = (Unit)target;
if (unit != null)
{
var o = unit.Orientation;
var newx = unit.Position.X - (unit.BoundingRadius + 0.5f) * (float)Math.Cos(o);
var newy = unit.Position.Y - (unit.BoundingRadius + 0.5f) * (float)Math.Sin(o);
var newpos = new Util.Graphics.Vector3(newx, newy, unit.Position.Z);
m_cast.CasterChar.TeleportTo(newpos, o);
}
}
else
{
// teleport to given target location
var map = m_cast.TargetMap;
var pos = m_cast.TargetLoc;
var ori = m_cast.TargetOrientation;
target.AddMessage(() => ((Unit)target).TeleportTo(map, pos, ori));
}
}
}
示例2: Apply
protected override void Apply(WorldObject target)
{
if (Effect.Spell.IsHearthStoneSpell && m_cast.CasterChar != null)
{
// teleport back home
var pos = m_cast.CasterChar.BindLocation;
target.AddMessage(() => ((Unit)target).TeleportTo(pos));
}
else
{
// teleport to given target location
var region = m_cast.TargetMap;
var pos = m_cast.TargetLoc;
var ori = m_cast.TargetOrientation;
target.AddMessage(() => ((Unit)target).TeleportTo(region, pos, ori));
}
}