本文整理汇总了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));
}
}