本文整理汇总了C#中Unit.IsStunned方法的典型用法代码示例。如果您正苦于以下问题:C# Unit.IsStunned方法的具体用法?C# Unit.IsStunned怎么用?C# Unit.IsStunned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit.IsStunned方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChainStun
public static bool ChainStun(Unit unit, double delay, string except, bool onlychain)
{
var chain = false;
var stunned = false;
string[] modifiersList =
{
"modifier_shadow_demon_disruption", "modifier_obsidian_destroyer_astral_imprisonment_prison",
"modifier_eul_cyclone", "modifier_invoker_tornado", "modifier_bane_nightmare",
"modifier_shadow_shaman_shackles",
"modifier_crystal_maiden_frostbite", "modifier_ember_spirit_searing_chains",
"modifier_axe_berserkers_call",
"modifier_lone_druid_spirit_bear_entangle_effect", "modifier_meepo_earthbind",
"modifier_naga_siren_ensnare",
"modifier_storm_spirit_electric_vortex_pull", "modifier_treant_overgrowth", "modifier_cyclone",
"modifier_sheepstick_debuff", "modifier_shadow_shaman_voodoo", "modifier_lion_voodoo",
"modifier_brewmaster_storm_cyclone",
"modifier_puck_phase_shift", "modifier_dark_troll_warlord_ensnare",
"modifier_invoker_deafening_blast_knockback"
};
var modifiers = unit.Modifiers.OrderByDescending(x => x.RemainingTime);
foreach (var m in modifiers.Where(m => (m.IsStunDebuff || modifiersList.Contains(m.Name)) && (except == null || m.Name == except)))
{
stunned = true;
var remainingTime = m.RemainingTime;
if (m.Name == "modifier_eul_cyclone" || m.Name == "modifier_invoker_tornado")
remainingTime += 0.07f;
chain = remainingTime <= delay;
}
return ((((!(stunned || unit.IsStunned()) || chain) && !onlychain) || (onlychain && chain)));
}
示例2: CanCast
private static bool CanCast(Unit source, Ability ability)
{
if (!Utils.SleepCheck("cast" + ability.Handle)) return false;
Utils.Sleep(1000+Game.Ping, "cast" + ability.Handle);
return ((Math.Round(source.Mana) - ability.ManaCost >= 0) && ability.Cooldown == 0f && ability.Level != 0 && !source.IsStunned());
}
示例3: CastStun
/// <summary>
/// Uses given ability in case enemy is not disabled or would be chain stunned.
/// </summary>
/// <param name="ability">
/// The ability.
/// </param>
/// <param name="target">
/// The target.
/// </param>
/// <param name="sourcePosition">
/// The source Position.
/// </param>
/// <param name="straightTimeforSkillShot">
/// The straight Time for Skill Shot.
/// </param>
/// <param name="chainStun">
/// The chain Stun.
/// </param>
/// <param name="useSleep">
/// The use Sleep.
/// </param>
/// <param name="abilityName">
/// The ability Name.
/// </param>
/// <param name="soulRing">
/// The soul Ring.
/// </param>
/// <param name="otherTargets">
/// The other Targets.
/// </param>
/// <returns>
/// returns true in case of successful cast
/// </returns>
public static bool CastStun(
this Ability ability,
Unit target,
Vector3 sourcePosition,
float straightTimeforSkillShot = 0,
bool chainStun = true,
bool useSleep = true,
string abilityName = null,
Ability soulRing = null,
List<Unit> otherTargets = null)
{
if (!ability.CanBeCasted())
{
return false;
}
if (target == null || !target.IsValid)
{
return false;
}
var name = abilityName ?? ability.StoredName();
var delay = ability.GetHitDelay(target, name) + 0.1f;
var canUse = Utils.ChainStun(target, delay, null, false, name);
if (!canUse && chainStun
&& (!target.HasModifier("modifier_pudge_meat_hook")
|| (ability.StoredName() != "pudge_dismember" && ability.StoredName() != "pudge_rot")))
{
return false;
}
if (ability.IsAbilityBehavior(AbilityBehavior.UnitTarget, name) && name != "lion_impale"
&& !target.IsInvul())
{
if (!ability.CanHit(target, sourcePosition))
{
return false;
}
if (ability.ManaCost > 0 && soulRing.CanBeCasted())
{
soulRing.UseAbility();
}
ability.UseAbility(target);
}
else if (ability.IsAbilityBehavior(AbilityBehavior.AreaOfEffect, name)
|| ability.IsAbilityBehavior(AbilityBehavior.Point, name) || name == "lion_impale"
|| (name == "earthshaker_enchant_totem" && (ability.Owner as Hero).AghanimState())
|| ability.IsSkillShot())
{
var stunned = target.IsStunned() || target.IsInvul() || target.IsRooted() || target.IsHexed();
if ((!(Prediction.StraightTime(target) > straightTimeforSkillShot * 1000) && !stunned)
|| !ability.CastSkillShot(target, name, soulRing, otherTargets))
{
return false;
}
if (useSleep)
{
Utils.Sleep(Math.Max(delay, 0.2) * 1000 + 250, "CHAINSTUN_SLEEP");
}
return true;
}
else if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name))
{
//.........这里部分代码省略.........
示例4: IsIdle
/// <summary>
/// Checks if enemy is not moving
/// </summary>
/// <param name="unit"></param>
/// <returns></returns>
public static bool IsIdle(Unit unit)
{
// var modifiers = unit.Modifiers;
return unit.IsInvul() || unit.IsStunned()
|| (unit.NetworkActivity == NetworkActivity.Idle
&& (!SpeedDictionary.ContainsKey(unit.Handle) || SpeedDictionary[unit.Handle] == Vector3.Zero))
|| unit.IsAttacking();
}