本文整理汇总了C#中Enemy.getHealth方法的典型用法代码示例。如果您正苦于以下问题:C# Enemy.getHealth方法的具体用法?C# Enemy.getHealth怎么用?C# Enemy.getHealth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy.getHealth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setEnemy
public void setEnemy (Enemy enemy) {
this.enemy = enemy;
enemyMax = enemy.getHealth();
updateEnemyBar();
}
示例2: Update
// Update is called once per frame
void Update()
{
// foreach (Guildie g in guildies) {
// enemy.recieveDamage(g.damagePerFrame(Time.deltaTime));
// }
//Has enemy receive damage and manages the different sublevels
enemy.recieveDamage(guildieDPS * Time.deltaTime);
if (enemy.bIsSpawnable) {
if (--subLevel <= 0) {
level++;
if (level % 5 != 0) {
subLevel = 10;
} else {
subLevel = 1;
}
}
Text lvl = GameObject.FindWithTag("Level").GetComponent<Text>();
if (level % 5 != 0) {
lvl.text = "Level " + level +"\n" + subLevel + " Enemies Left";
} else {
lvl.text = "Level " + level +"\nBOSS LEVEL";
}
dieingEnemies.Add (enemy);
player.addXp(enemy.xpDrop());
enemy = Instantiate(enemyPrefab);
enemy.setHealth(level);
enemy.setXP(level);
// enemy.boss(level);
enemyHp.maxValue = enemy.getHealth();
}
/*
for (int i = 0; i < dieingEnemies.Count; i++) {
if (e.bIsDead) {
GameObject.Destroy (e.gameObject);
dieingEnemies.Remove (e);
}
}
*/
//Resets player click damage if it doesn't equal player damage
if (enemy.getPlayerClickDamage() != player.getPlayerDamage()) {
enemy.setPlayerClickDamage(player.getPlayerDamage());
}
updateUI();
}
示例3: ProcessAim
//Process the aimed down location
IEnumerator ProcessAim(bool hit, Enemy e)
{
if (hit)
{
e.takeHit(player.getAttack());
print("Enemy " + e.getCode() + " Health: " + e.getHealth());
if (e.getDead())
{
board.removeEnemy(e);
}
}
else
{
List<Enemy> enemies = board.getEnemies();
foreach(Enemy enem in enemies)
{
// enem.attackPlayer(player);
print("Player Health: " + player.getCurrHP());
}
}
yield return new WaitForSeconds(10.0f / 60.0f);
aiming = true;
if (board.getEnemies().Count == 0)
{
Application.LoadLevel("GameOver");
} else
{
StartCoroutine("Aim");
}
}
示例4: Start
// Use this for initialization
void Start()
{
//Initializes and displays all the GUI stuff with the needed information
enemyHp = GameObject.FindWithTag("EnemyHp").GetComponent<Slider>();
xpBar = GameObject.FindWithTag("XpBar").GetComponent<Slider>();
clickDmg = GameObject.FindWithTag("ClickDamage").GetComponent<RectTransform>();
guildDmg = GameObject.FindWithTag("GuildieDamage").GetComponent<RectTransform>();
enemyHP = GameObject.FindWithTag ("EnemyHealth").GetComponent<RectTransform> ();
numOfGuildies = GameObject.FindWithTag ("GuildMembers").GetComponent<RectTransform> ();
//numberOfGuildies = GameObject.GetComponent<Text>;
//Creates enemy and sets up all their attributes
enemy = Instantiate(enemyPrefab);
enemy.setPlayerClickDamage(player.getPlayerDamage());
enemy.setHealth(level);
enemy.setXP(level);
// enemy.boss(level);
// Guildie g = new Guildie();
// guildies.Add(g);
enemyHp.maxValue = enemy.getHealth ();
}
示例5: attack
/*********************** Attack *****************************/
public string attack(Enemy e)
{
//string name = e.typeID;
/* if (soundComponent.characterAudio.isPlaying && soundComponent.characterClip < Sounds.SWORD_HIT) {
soundComponent.stopSound("character");
}*/
animatorComponent.SetBool("Attacking", true);
string message = "Miss! ";
if(stamina > 0){
if(GameObject.Find("Health").GetComponent<Image>().isActiveAndEnabled == false){
this.GetComponent<Tutorial>().showHealthHint();
}
e.lastDamage = Time.time;
float ran = UnityEngine.Random.value;
float hc = hitChance;
if (ran <= hc) {
message = "Hit! ";
float cc = critChance;
int tmpdamage = damage;
/*Critical Hit */
if (ran <= cc) {
tmpdamage *= CRIT_MULT;
message = "Critical Hit! ";
if (weapon != null){
if (weapon.typeID == "Warhammer") {
soundComponent.playCharacterSound (Sounds.HAMMER_CRIT);
} else {
soundComponent.playCharacterSound (Sounds.SWORD_CRIT);
}
} else {
soundComponent.playCharacterSound (Sounds.FISTS_CRIT);
}
} else {
/* Non-crit Sounds */
if (weapon != null){
if (weapon.typeID == "Warhammer") {
soundComponent.playCharacterSound (Sounds.HAMMER_HIT);
} else {
soundComponent.playCharacterSound (Sounds.SWORD_HIT);
}
} else {
soundComponent.playCharacterSound (Sounds.FISTS_HIT);
}
}
bool dead = e.loseHP(tmpdamage);
if (weapon != null) {
stamina -= weapon.staminaLoss;
GameObject.Find("Stamina").GetComponent<Image>().fillAmount = stamina/maxStamina();
} else {
stamina -= STAMINA_LOSS;
GameObject.Find("Stamina").GetComponent<Image>().fillAmount = stamina/maxStamina();
}
if (dead) {
message += " Monster died!\n";
message += addXP(e.level * XP_GAIN_PER_MONSTER_LEVEL) + "\n";
} else {
//add Stats to message
message += e.getHealth()+"/"+e.getMaxHp();
}
} else if (message == "Miss! ") {
soundComponent.playCharacterSound(Sounds.MISS);
message += e.getHealth () + "/" + e.getMaxHp ();
}
} else {
soundComponent.playCharacterSound(Sounds.MISS);
}
return message;
}