47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using NaughtyAttributes;
|
|
using UnityEngine;
|
|
|
|
public class VampireEntity : Entity {
|
|
[SerializeField]
|
|
[field: Required]
|
|
PlayerStats playerStats = null!;
|
|
|
|
// [SerializeField] [Required]
|
|
// HealthBar healthBar;
|
|
[HideInInspector] public PlayerMovement playerMovement;
|
|
[HideInInspector] public ScreenShaker screenShaker;
|
|
|
|
protected override void Awake() {
|
|
base.Awake();
|
|
transform.SetParent(arena.minionParent);
|
|
screenShaker = FindObjectOfType<ScreenShaker>();
|
|
}
|
|
|
|
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, sound: false);
|
|
}
|
|
|
|
public override bool TakeDamage(float amount, Entity other, bool sound = true, bool intentional = false) {
|
|
if (sound && !intentional) {
|
|
screenShaker.Shake();
|
|
}
|
|
|
|
return base.TakeDamage(amount, other, sound, intentional);
|
|
}
|
|
|
|
public bool IsInSafeZone() => playerMovement.IsInSafeZone;
|
|
|
|
protected override void OnDied() {
|
|
OnEmpty();
|
|
gameFlowManager.GameOver();
|
|
}
|
|
} |