本文整理汇总了C#中Enemy.Attack方法的典型用法代码示例。如果您正苦于以下问题:C# Enemy.Attack方法的具体用法?C# Enemy.Attack怎么用?C# Enemy.Attack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy.Attack方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Attack
public bool Attack(Enemy enemy)
{
string[] checkObjs = enemy.CanBeDefeatedBy();
foreach (string obj in checkObjs)
{
if (equippedItem != null && equippedItem.ToString().ToLower() == obj.ToLower () && (CheckFatigue() ? true : (Random.Range (0, 11) > 5 ? true : false)))
{
hunger = Mathf.Clamp(hunger - enemy.Attack() / 4, 0, 100);
tiredness = Mathf.Clamp(tiredness - enemy.Attack() / 4, 0, 100);
return true;
}
if (equippedItem == null && obj.ToLower() == "fists" && (CheckFatigue() ? true : (Random.Range (0, 11) > 5 ? true : false)))
return true;
}
hunger = Mathf.Clamp (hunger - enemy.Attack() / 2, 0, 100);
tiredness = Mathf.Clamp (tiredness - enemy.Attack() / 4, 0, 100);
return false;
}
示例2: DoActivity
// Tue die Action
public override void DoActivity(Enemy e)
{
// laufe zu nächstem pfad
if (_lookAtNextNode)
{
PathNode next = _currentPath;
// schaue zu nächstem wegpunkt
if (next != null)
e.LookAt(next.WayPoint.Location.Position);
}
// schaue auf player
if (_lookAtPlayer)
{
e.LookAt(_player.LocationBehavior.Position);
}
// greife an
if (_attack && Main.MainObject.GameManager.GameState.Player.IsAlive)
{
e.Attack();
}
// laufe gerade aus (richtung wp)
if (_walk)
{
Vector2 moved = Move(e);
_walkedDistance = (float)(moved.Length() / Main.GameTimeUpdate.ElapsedGameTime.TotalSeconds);
}
}
示例3: Attack
private static void Attack(Player p, Enemy e, int num_figths)
{
int EnemyWins = 0;
int PlayerWins = 0;
for (int i = 0; i < num_figths; i++)
{
p.Hp = 12;
e.Hp = 10;
Logger.Log("===============================", ConsoleColor.Red);
Logger.Log(string.Format("Combat number #{0} starts", i + 1), ConsoleColor.White);
Logger.Log("===============================", ConsoleColor.Red);
while (true)
{
p.Attack(e);
if (e.Hp <= 0)
break;
e.Attack(p);
if (p.Hp <= 0)
break;
}
if (p.Hp <= 0)
{
Logger.Log(string.Format("{0}Died!!!", p.Name), ConsoleColor.Yellow);
EnemyWins++;
}
if (e.Hp <= 0)
{
Logger.Log(string.Format("{0}Died!!!", e.Name), ConsoleColor.Yellow);
PlayerWins++;
}
}
float floatx = float.Parse(PlayerWins.ToString());
Logger.LogTrue(string.Format("Total Fights {0}, {1} wins {2} - {5}%, {3} wins {4} - {6}%",
num_figths, p.Name,
PlayerWins, e.Name, EnemyWins,
(float)PlayerWins / num_figths * 100,
(float)EnemyWins / num_figths * 100), ConsoleColor.Cyan);
}
示例4: TakeDamage
// True, player lives. False, player dies.
public bool TakeDamage(Enemy enemy)
{
if (enemy.Attack() >= health)
return false;
hunger = Mathf.Clamp(hunger - enemy.Attack() / 4, 0, 100);
tiredness = Mathf.Clamp (tiredness - enemy.Attack() / 2, 0, 100);
health = Mathf.Clamp (health - enemy.Attack(), 0, 100);
return true;
}
示例5: Battle
private void Battle(Sibling sibling, Enemy enemy)
{
if(sibling.Weapon.Beats(enemy.Weapon)) {
sibling.Attack();
enemy.Die();
} else if(enemy.Weapon.Beats(sibling.Weapon)) {
if(sibling.Ability) {
sibling.UseAbility();
enemy.Die();
} else {
sibling.Die();
enemy.Attack();
}
}
}