本文整理汇总了C#中Unit类的典型用法代码示例。如果您正苦于以下问题:C# Unit类的具体用法?C# Unit怎么用?C# Unit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Unit类属于命名空间,在下文中一共展示了Unit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddModifierObstacle
public void AddModifierObstacle(Modifier modifier, Unit unit)
{
if (Obstacle != null)
{
End();
}
}
示例2: CheckTarget
private static bool CheckTarget(Unit enemy, bool doubleOwnage = false)
{
if (enemy.IsIllusion || !enemy.IsValidTarget(dagon.GetCastRange(), true, hero.NetworkPosition))
{
return false;
}
if (enemy.IsLinkensProtected() || enemy.IsMagicImmune())
{
return false;
}
if (!enemy.CanDie() || enemy.Modifiers.Any(x => IgnoreModifiers.Any(x.Name.Equals)))
{
return false;
}
var damage = AbilityDamage.CalculateDamage(dagon, hero, enemy);
if (doubleOwnage)
{
damage *= 2;
}
return enemy.Health < damage;
}
示例3: AddUnit
public void AddUnit(Unit unit)
{
abilityUnit = unit;
StartCast = Game.RawGameTime;
EndCast = Game.RawGameTime + GetCastRange() / GetProjectileSpeed();
StartPosition = unit.Position;
}
示例4: Element
protected Line Element(Unit left = default(Unit),
Unit top = default(Unit),
Unit innerHeight = default(Unit),
bool breakable = false,
bool followLineHeight = false,
Unit border = default(Unit),
bool keepWithNextLine = false,
Behaviors behavior = null,
IEnumerable<Line> children = null)
{
// Top offsets are not allowed in real usage, so we fake one by adding an element
if (lines.Count == 0 && top > 0.cm())
{
lines.Add(new Line(0.cm(), false, new LayoutedElement(new TestSpecification
{
Breakable = true,
OrphanHeight = 0.cm(),
WidowHeight = 0.cm()
}, Children.Empty)
{
Name = "Spacer",
ForcedInnerHeight = top,
}));
}
var line = ChildElement(left, top, innerHeight, breakable, followLineHeight, border, keepWithNextLine, behavior, children);
lines.Add(line);
return line;
}
示例5: RunEffect
public override void RunEffect(Unit u, bool reapply = false)
{
base.RunEffect(u, reapply);
//give shield
u.shield += shieldAmount;
}
示例6: OnEnable
void OnEnable()
{
Owner = GetComponent<Unit>();
MainController.Instance.FocusedUnit = Owner;
MainController.Instance.SwitchSkill(0);
MainController.Instance.MoveControlPad.Init(Owner);
}
示例7: ReportGauge
protected override void ReportGauge(string name, double value, Unit unit, MetricTags tags)
{
if (!double.IsNaN(value) && !double.IsInfinity(value))
{
Pack(name, value, tags);
}
}
示例8: OneUnitDefaultName
public void OneUnitDefaultName()
{
var meter = new Unit("meter");
var oneMeter = new Measurement(meter, 1M);
oneMeter.ToString().Should().Be("1 meter");
}
示例9: OnShow
protected override void OnShow()
{
if(m_Unit == null)
m_Unit = base.Player.CurrentPartyUnit;
Prepare();
}
示例10: OunceAndPound
public void OunceAndPound(Unit unit, Unit servingSizeUnit)
{
sut.Unit = unit;
Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
Assert.IsTrue(sut.AreNutrientsPer100gUsable);
Assert.IsFalse(sut.AreNutrientsPerServingUsable);
product.ServingSizeValue = 1;
product.ServingSizeUnit = servingSizeUnit;
Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
Assert.IsTrue(sut.AreNutrientsPer100gUsable);
Assert.IsTrue(sut.AreNutrientsPerServingUsable);
product.EnergyPerServing = 0;
Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
Assert.IsTrue(sut.AreNutrientsPer100gUsable);
Assert.IsFalse(sut.AreNutrientsPerServingUsable);
sut.Unit = Unit.ServingSize;
Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
Assert.IsTrue(sut.AreNutrientsPer100gUsable);
Assert.IsFalse(sut.AreNutrientsPerServingUsable);
product.EnergyPerServing = 100;
Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
Assert.IsFalse(sut.AreNutrientsPer100gUsable);
Assert.IsTrue(sut.AreNutrientsPerServingUsable);
product.EnergyPer100g = 0;
sut.Unit = unit;
Assert.IsTrue(sut.AnyNutrientsPerUnitPresent);
Assert.IsFalse(sut.AreNutrientsPer100gUsable);
Assert.IsTrue(sut.AreNutrientsPerServingUsable);
}
示例11: CancelAction
//Cancel the currently displayed action
public void CancelAction()
{
selectedUnit = null;
m_tiles.ClearSelectedTiles();
m_hud.HideUnitInfo();
e_playerState = PlayerState.Default;
}
示例12: AttackUnit
public static bool AttackUnit(Unit unit, TimeSpan timeout)
{
if (unit.Type == UnitType.Monster
&& unit.GetAttributeInteger(UnitAttribute.Is_NPC) == 0
&& unit.GetAttributeInteger(UnitAttribute.Is_Helper) == 0
&& unit.GetAttributeInteger(UnitAttribute.Invulnerable) == 0)
{
switch (Me.SNOId)
{
case SNOActorId.Barbarian_Male:
case SNOActorId.Barbarian_Female:
//return Classes.Barbarian.AttackUnit(unit, timeout);
break;
case SNOActorId.WitchDoctor_Male:
case SNOActorId.WitchDoctor_Female:
//return Classes.WitchDoctor.AttackUnit(unit, timeout);
break;
case SNOActorId.Wizard_Male:
case SNOActorId.Wizard_Female:
//return Classes.Wizard.AttackUnit(unit, timeout);
break;
case SNOActorId.Demonhunter_Male:
case SNOActorId.Demonhunter_Female:
return DemonHunter.AttackUnit(unit, timeout);
case SNOActorId.Monk_Male:
case SNOActorId.Monk_Female:
return Monk.AttackUnit(unit, timeout);
}
}
return false;
}
示例13: 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)));
}
示例14: Update
public override void Update(Unit unit, IGame game)
{
base.Update(unit, game);
if ((game.Time - unit.BirthTime) > FleeTime)
unit.setState(UnitFactories.States.Create(unit.Name, "fleeing"), game);
}
示例15: AddEnermy
public void AddEnermy(Unit addUnit)
{
bool b_set = false;
addUnit.m_ai.m_TeamType = eUnitType.Enermy;
for (int i = 0; i < m_enermyUnitList.Count; ++i)
{
if(m_enermyUnitList[i] == null)
{
m_enermyUnitList[i] = addUnit;
b_set = true;
break;
}
}
if(b_set == false)
{
m_enermyUnitList.Add(addUnit);
}
if(NewUnitCall != null)
{
NewUnitCall(addUnit);
}
}