本文整理汇总了C#中Hero.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Hero.Equals方法的具体用法?C# Hero.Equals怎么用?C# Hero.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero.Equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: place
public void place(Vector3 pos, Hero.Side s)
{
if (s.Equals(Hero.Side.LEFT))
{
transform.localScale = new Vector3(-0.5f, 0.5f, 0.5f);
}
else
{
transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
}
side = s;
transform.position = pos;
setSprite(3);
}
示例2: Evade
private bool Evade(Hero ally, IEnumerable<uint> intersection)
{
var heroCanCast = Hero.CanCast();
var heroCanUseItems = Hero.CanUseItems();
var allyLinkens = ally.IsLinkensProtected();
var allyMagicImmune = ally.IsMagicImmune();
var allyIsMe = ally.Equals(Hero);
var allyHp = ally.Health;
//var heroMp = Hero.Mana;
foreach (var ability in
intersection.Select(
x =>
abilityUpdater.EvadableAbilities.FirstOrDefault(
z => z.Obstacle == x && (z.AllyHpIgnore <= 0 || allyHp < z.AllyHpIgnore)
//&& (z.HeroMpIgnore <= 0 || heroMp > z.HeroMpIgnore)
&& (z.AbilityLevelIgnore <= 0 || z.Level > z.AbilityLevelIgnore)))
.Where(x => x != null)
.OrderByDescending(x => x.IsDisable))
{
if (ability == null || sleeper.Sleeping(ability))
{
continue;
}
if ((allyLinkens && (ability is Projectile || ability is LinearTarget))
|| (!ability.PiercesMagicImmunity && allyMagicImmune))
{
continue;
}
Debugger.WriteLine(
ally.GetName() + " intersecting: " + ability.Name + " // " + Game.RawGameTime,
Debugger.Type.Intersectons);
var abilityOwner = ability.AbilityOwner;
var remainingTime = ability.GetRemainingTime(ally);
foreach (var priority in
ability.UseCustomPriority ? ability.Priority : Menu.Settings.DefaultPriority)
{
switch (priority)
{
case EvadePriority.Walk:
if (allyIsMe && !ability.DisablePathfinder && Menu.Hotkeys.EnabledPathfinder
&& Hero.CanMove())
{
var remainingWalkTime = remainingTime - 0.1f;
if (sleeper.Sleeping("block"))
{
continue;
}
bool success;
List<Vector3> path;
if (Hero.IsMoving && !movePosition.IsZero)
{
if (ability.ObstacleStays && remainingWalkTime <= 0)
{
remainingWalkTime = ability.ObstacleRemainingTime();
}
if (remainingWalkTime <= 0)
{
continue;
}
if (Pathfinder.GetIntersectingObstacles(movePosition, Hero.HullRadius).Any()
|| Pathfinder.GetIntersectingObstacles(Hero.NetworkPosition, Hero.HullRadius)
.Any())
{
Debugger.WriteLine("moving into obstacle", Debugger.Type.AbilityUsage);
var tempPath =
Pathfinder.CalculatePathFromObstacle(
Hero.NetworkPosition,
movePosition,
remainingWalkTime,
out success).ToList();
if (success)
{
movePathfinderPosition = tempPath.Last();
}
else
{
continue;
}
}
if (!ability.ObstacleStays)
{
Pathfinder.CalculatePathFromObstacle(remainingWalkTime - 0.2f, out success);
if (success)
{
return false;
}
//.........这里部分代码省略.........
示例3: AddHeroMenu
public async Task AddHeroMenu(Hero hero)
{
var heroName = hero.StoredName();
var heroMenu = new Menu(hero.GetRealName(), heroName, false, heroName, true);
menu.AddSubMenu(heroMenu);
heroMenus.Add(hero, heroMenu);
var key = hero.StoredName();
if (hero.Equals(myHero))
{
key += "myHero";
}
var settings = new Menu("Settings", key + "settings");
heroMenus.First(x => x.Key.Equals(hero)).Value.AddSubMenu(settings);
await Task.Delay(200);
var abilities = new MenuItem(key + "generateAbilities", "Generate ability ranges").SetValue(false);
settings.AddItem(abilities);
await Task.Delay(200);
abilities.ValueChanged += async (sender, args) => {
if (!args.GetNewValue<bool>())
{
args.Process = false;
return;
}
await AddAbilities(hero);
};
if (abilities.IsActive())
{
await AddAbilities(hero);
}
var items = new MenuItem(key + "generateItems", "Generate item ranges").SetValue(false);
enabledItemsMenu.Add(hero, items);
settings.AddItem(items);
await Task.Delay(200);
items.ValueChanged += async (sender, args) => {
if (!args.GetNewValue<bool>())
{
args.Process = false;
return;
}
await AddAItems(hero);
};
if (items.IsActive())
{
await AddAItems(hero);
}
var attack = new MenuItem(key + "generateAttack", "Generate attack range").SetValue(false);
settings.AddItem(attack);
await Task.Delay(200);
attack.ValueChanged += async (sender, args) => {
if (!args.GetNewValue<bool>())
{
args.Process = false;
return;
}
await AddMenuItem(hero, null, Ranges.CustomRange.Attack);
};
if (attack.IsActive())
{
await AddMenuItem(hero, null, Ranges.CustomRange.Attack);
}
var expirience = new MenuItem(key + "generateExpirience", "Generate expirience range").SetValue(false);
settings.AddItem(expirience);
await Task.Delay(200);
expirience.ValueChanged += async (sender, args) => {
if (!args.GetNewValue<bool>())
{
args.Process = false;
return;
}
await AddMenuItem(hero, null, Ranges.CustomRange.Expiriece);
};
if (expirience.IsActive())
{
await AddMenuItem(hero, null, Ranges.CustomRange.Expiriece);
}
}
示例4: CheckIsHeroExist
public bool CheckIsHeroExist(Hero hero)
{
return (hero.Equals(heros[0])
|| hero.Equals(heros[1]));
}
示例5: AddMenuItem
public async Task AddMenuItem(
Hero hero,
Ability ability,
Ranges.CustomRange customRange = Ranges.CustomRange.None)
{
var isItem = ability is Item;
var abilityName = isItem ? ability.GetDefaultName() : ability?.StoredName();
var texture = abilityName;
var menuName = string.Empty;
switch (customRange)
{
case Ranges.CustomRange.Attack:
abilityName = "attackRange";
menuName = "Attack range";
texture = null;
break;
case Ranges.CustomRange.Expiriece:
abilityName = "expRange";
menuName = "Exp range";
texture = null;
break;
}
if (string.IsNullOrEmpty(abilityName))
{
return;
}
var key = hero.StoredName() + abilityName;
if (hero.Equals(myHero))
{
key += "myHero";
}
var abilityMenu = new Menu(texture == null ? menuName : " ", key, false, texture, true);
var enable = new MenuItem(key + "enabled", "Enabled").SetValue(false);
await Task.Delay(100);
var radiusOnly = new MenuItem(key + "radius", "Damage radius only").SetValue(false);
await Task.Delay(100);
var red = new MenuItem(key + "red", "Red").SetValue(new Slider(255, 0, 255));
await Task.Delay(100);
var green = new MenuItem(key + "green", "Green").SetValue(new Slider(0, 0, 255));
await Task.Delay(100);
var blue = new MenuItem(key + "blue", "Blue").SetValue(new Slider(0, 0, 255));
await Task.Delay(100);
enable.ValueChanged += (sender, arg) => {
var enabled = arg.GetNewValue<bool>();
abilityMenu.DisplayName = enabled
? abilityMenu.DisplayName + "*"
: abilityMenu.DisplayName.Replace("*", "");
OnChange?.Invoke(
this,
new AbilityEventArgs
{
Hero = hero,
Name = abilityName,
Enabled = enabled,
Redraw = true
});
};
radiusOnly.ValueChanged += (sender, args) => {
OnChange?.Invoke(
this,
new AbilityEventArgs
{
Hero = hero,
Name = abilityName,
Enabled = enable.IsActive(),
RadiusOnly = args.GetNewValue<bool>(),
Redraw = true
});
};
red.ValueChanged += (sender, arg) => {
OnChange?.Invoke(
this,
new AbilityEventArgs
{
Hero = hero,
Name = abilityName,
Red = arg.GetNewValue<Slider>().Value
});
};
green.ValueChanged += (sender, arg) => {
OnChange?.Invoke(
this,
new AbilityEventArgs
{
Hero = hero,
Name = abilityName,
Green = arg.GetNewValue<Slider>().Value
//.........这里部分代码省略.........