本文整理汇总了C#中Spellbook.CastSpell方法的典型用法代码示例。如果您正苦于以下问题:C# Spellbook.CastSpell方法的具体用法?C# Spellbook.CastSpell怎么用?C# Spellbook.CastSpell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spellbook
的用法示例。
在下文中一共展示了Spellbook.CastSpell方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Spellbook_OnCastSpell
void Spellbook_OnCastSpell(Spellbook sender, SpellbookCastSpellEventArgs args)
{
if (!IsActive())
return;
if (_latestSpellSlot != SpellSlot.Unknown && sender.Owner.IsMe && IsWard(sender, args))
{
_drawSpots = false;
foreach (WardSpot wardSpot in WardSpots)
{
if (!wardSpot.SafeWard &&
Vector3.Distance(wardSpot.Pos,
new Vector3(args.StartPosition.X, args.StartPosition.Y, args.StartPosition.Z)) <= 250 &&
!_wardAlreadyCorrected)
{
args.Process = false;
_wardAlreadyCorrected = true;
//SendPacket
//var sCastPacket = new byte[28];
//var writer = new BinaryWriter(new MemoryStream(sCastPacket));
//writer.Write((byte)0x9A);
//writer.Write(mNetworkId);
//writer.Write(spellId);
//writer.Write(unknown);
//writer.Write(wardSpot.Pos.X);
//writer.Write(wardSpot.Pos.Y);
//writer.Write(wardSpot.Pos.X);
//writer.Write(wardSpot.Pos.Y);
//writer.Write(tNetworkId);
//Game.SendPacket(sCastPacket, PacketChannel.C2S, PacketProtocolFlags.Reliable);
sender.CastSpell(
args.Slot,
new Vector3(
wardSpot.Pos.X, wardSpot.Pos.Y,
NavMesh.GetHeightForPosition(wardSpot.Pos.X, wardSpot.Pos.Y)));
//Packet.C2S.Cast.Encoded(new Packet.C2S.Cast.Struct(decoded.TargetNetworkId, decoded.Slot, decoded.SourceNetworkId,
// wardSpot.Pos.X, wardSpot.Pos.Y, wardSpot.Pos.X, wardSpot.Pos.Y, decoded.SpellFlag)).Send();
//TODO: Check if its correct
_wardAlreadyCorrected = false;
return;
}
if (wardSpot.SafeWard &&
Vector3.Distance(wardSpot.MagneticPos,
new Vector3(args.StartPosition.X, args.StartPosition.Y, args.StartPosition.Z)) <=
250 &&
!_wardAlreadyCorrected)
{
args.Process = false;
ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo,
new Vector3(wardSpot.MovePos.X, wardSpot.MovePos.Y, wardSpot.MovePos.Z));
_latestWardSpot = wardSpot;
return;
}
}
}
}