Ensage.Common.UnitDatabase.GetAttackPoint C# (CSharp) Метод

GetAttackPoint() публичный статический Метод

Gets the attack point.
public static GetAttackPoint ( Hero unit ) : double
unit Hero /// The unit. ///
Результат double
        public static double GetAttackPoint(Hero unit)
        {
            if (unit == null)
            {
                return 0;
            }

            try
            {
                var name = unit.StoredName();
                double attackAnimationPoint;
                if (!AttackPointDictionary.TryGetValue(unit.Handle, out attackAnimationPoint))
                {
                    attackAnimationPoint =
                        Game.FindKeyValues(name + "/AttackAnimationPoint", KeyValueSource.Hero).FloatValue;
                    AttackPointDictionary.Add(unit.Handle, attackAnimationPoint);
                }

                var attackSpeed = GetAttackSpeed(unit);
                return attackAnimationPoint / (1 + (attackSpeed - 100) / 100);
            }
            catch (KeyValuesNotFoundException)
            {
                if (!Utils.SleepCheck("Ensage.Common.DemoModeWarning"))
                {
                    return 0;
                }

                Utils.Sleep(10000, "Ensage.Common.DemoModeWarning");
                Console.WriteLine(@"[[Please do not use demo mode for testing assemblies]]");
                return 0;
            }
        }

Same methods

UnitDatabase::GetAttackPoint ( Unit unit ) : double

Usage Example

Пример #1
0
        /// <summary>
        ///     Checks if attack animation can be safely canceled
        /// </summary>
        /// <returns></returns>
        public static bool CanCancelAnimation(float delay = 0f)
        {
            var time      = (tick - LastAttackStart);
            var cancelDur = UnitDatabase.GetAttackPoint(me) * 1000 - Game.Ping + 50 - delay;

            return(time > cancelDur);
        }
All Usage Examples Of Ensage.Common.UnitDatabase::GetAttackPoint