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

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

Gets the attack speed.
public static GetAttackSpeed ( Hero unit ) : float
unit Hero /// The unit. ///
Результат float
        public static float GetAttackSpeed(Hero unit)
        {
            try
            {
                double attackBaseTime;
                if (!AttackRateDictionary.TryGetValue(unit.Handle, out attackBaseTime))
                {
                    attackBaseTime =
                        Game.FindKeyValues(unit.StoredName() + "/AttackRate", KeyValueSource.Hero).FloatValue;
                    AttackRateDictionary.Add(unit.Handle, attackBaseTime);
                }

                var attackSpeed = Math.Min(unit.AttackSpeedValue, 600);

                if (unit.HasModifier("modifier_ursa_overpower"))
                {
                    attackSpeed = 600;
                }

                return (float)attackSpeed;
            }
            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::GetAttackSpeed ( Unit unit ) : float