public void damageHp(int hit) { if (this.currHp - hit > 0) { this.currHp -= hit; if (type == Type.Player) { player.imageEffectActive = true; player.updateHp(currHp); } } else { if (type == Type.Enemy && !isDead) { enemyAttrs.markAsDead(); player.addKill(enemyAttrs.type); roundManager.killOne(); } if (type == Type.Player && !isDead) { print("El jugador murio"); player.killPlayer(); } if (type == Type.Bullet) { Destroy(gameObject); } this.currHp = 0; isDead = true; /* * if (!isTarget) * { * if(!isPlayer) { * if (!this.isDead) * { * //para que no lo mate varias veces * isDead = true; * if (enemyAttrs != null) * { * //es un enemigo * enemyAttrs.markAsDead(); * player.addKill(); * roundManager.killOne(); * } * else * { * //es una bala * Destroy(gameObject); * } * } * } * else * { * print("el jugador se murio"); * } * } * else * { * this.isDead = true; * }*/ } }