29 lines
611 B
C#
29 lines
611 B
C#
//TODO Replace with Damageable?
|
|
|
|
using UnityEngine;
|
|
|
|
public class VampireEntity : Entity {
|
|
[SerializeField] HealthBar healthBar;
|
|
float initialHealth;
|
|
PlayerMovement playerMovement;
|
|
|
|
protected override void Start() {
|
|
base.Start();
|
|
base.entityName = "Vampire";
|
|
playerMovement = GetComponent<PlayerMovement>();
|
|
|
|
initialHealth = Health;
|
|
}
|
|
|
|
public override void TakeDamage(float amount) {
|
|
base.TakeDamage(amount);
|
|
healthBar.SetHealthFraction(Health / initialHealth);
|
|
}
|
|
|
|
public bool IsInSafeZone(){
|
|
if(playerMovement is null){
|
|
return false;
|
|
}
|
|
return playerMovement.IsInSafeZone();
|
|
}
|
|
} |