当前位置: 首页>>代码示例>>C#>>正文


C# Spellbook.CastSpell方法代码示例

本文整理汇总了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;
                    }
                }
            }
        }
开发者ID:kampfi,项目名称:SAwarenessBeta,代码行数:56,代码来源:WardCorrector.cs


注:本文中的Spellbook.CastSpell方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。