ludumdare50/Assets/Scripts/VampireEntity.cs
2022-04-03 16:35:45 -04:00

41 lines
990 B
C#

using NaughtyAttributes;
using UnityEngine;
public class VampireEntity : Entity {
[SerializeField] [field: Required]
PlayerStats playerStats = null!;
// [SerializeField] [Required]
// HealthBar healthBar;
[HideInInspector] public PlayerMovement playerMovement;
protected override void Awake() {
base.Awake();
transform.SetParent(arena.minionParent);
}
protected override void Start() {
base.Start();
base.entityType = EntityFlag.Vampire;
playerMovement = GetComponent<PlayerMovement>();
}
protected override void Update() {
base.Update();
if (gameFlowManager.CanDoAction)
TakeDamage(playerStats.bloodLossRate * Time.deltaTime, this);
}
// public override void TakeDamage(float amount) {
// base.TakeDamage(amount);
// healthBar.SetHealthFraction(Health / initialHealth);
// }
public bool IsInSafeZone() => playerMovement.IsInSafeZone;
protected override void OnDied() {
OnEmpty();
gameFlowManager.GameOver();
}
}