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


C# Spell.GetCollision方法代码示例

本文整理汇总了C#中LeagueSharp.Common.Spell.GetCollision方法的典型用法代码示例。如果您正苦于以下问题:C# Spell.GetCollision方法的具体用法?C# Spell.GetCollision怎么用?C# Spell.GetCollision使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LeagueSharp.Common.Spell的用法示例。


在下文中一共展示了Spell.GetCollision方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Cast

            /// <summary>
            /// Casts aoe spell
            /// </summary>
            /// <param name="s">Spell to cast</param>
            /// <param name="t">Target for spell</param>
            /// <param name="hc">Minimum HitChance to cast</param>
            /// <param name="minHit">Minimum Hit Count to cast</param>
            /// <param name="rangeCheckFrom">Position where spell will be casted from</param>
            /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param>
            /// <returns>true if spell has casted</returns>
            public static bool Cast(Spell s, Obj_AI_Hero t, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 2, Vector3? rangeCheckFrom = null, float filterHPPercent = 0)
            {
                if (!blInitialized)
                    throw new Exception("Prediction is not initalized");

                if (rangeCheckFrom == null)
                    rangeCheckFrom = ObjectManager.Player.ServerPosition;

                if (Monitor.TryEnter(EnemyInfo[t.NetworkId].m_lock))
                {
                    try
                    {
                        HitChance predictedhc = HitChance.Impossible;
                        float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay;
                        float movt = t.LastMovChangeTime();
                        Vector2 pos = ObjectManager.Player.ServerPosition.To2D();
                        switch (s.Type)
                        {
                            case SkillshotType.SkillshotLine:   pos = Line.GetPrediction(t, s, t.GetWaypoints(), avgt, movt, filterHPPercent, minHit, out predictedhc, rangeCheckFrom.Value);
                                break;
                            case SkillshotType.SkillshotCircle: pos = Circle.GetPrediction(t, s, t.GetWaypoints(), avgt, movt, filterHPPercent, minHit, out predictedhc, rangeCheckFrom.Value);
                                break;
                            case SkillshotType.SkillshotCone:   pos = Cone.GetPrediction(t, s, t.GetWaypoints(), avgt, movt, filterHPPercent, minHit, out predictedhc, rangeCheckFrom.Value);
                                break;
                        }

                        //pos = pos + pos.Perpendicular() * s.Width / 2; //need moar test (for lineaar skillshots)
                        if (s.Collision && s.GetCollision(rangeCheckFrom.Value.To2D(), new List<Vector2> { pos }).Exists(q => q.IsEnemy)) //needs update
                        {
                            Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock);
                            return false;
                        }

                        if (predictedhc >= hc)
                        {
                            s.Cast(pos);

                            return true;
                        }

                        Monitor.Pulse(EnemyInfo[t.NetworkId].m_lock);
                        return false;
                    }
                    finally
                    {
                        Monitor.Exit(EnemyInfo[t.NetworkId].m_lock);
                    }
                }
                return false;
            }
开发者ID:47110572,项目名称:LeagueSharp,代码行数:60,代码来源:Prediction.cs


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