TG9six bb58f5ed86 Visual Changes
Added NPCs for wave, added animations, added impact vfx for fireball
2025-09-02 20:39:37 +04:00

27 lines
761 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// MeleeEnemy.cs
using UnityEngine;
public class MeleeEnemy : EnemyBase
{
protected override void TryAttack()
{
if (Time.time - lastAttackTime < config.attackCooldown) return;
// still in range?
if (Vector3.Distance(transform.position, target.position) > config.attackRange) return;
// perform attack
lastAttackTime = Time.time;
// Damage the target if its damageable
if (target.TryGetComponent<IDamageable>(out var dmg))
{
dmg.ApplyDamage(config.attackDamage);
GetComponentInChildren<EnemyAnimationController>()?.PlayAttack();
}
// TODO: play swing anim / SFX here
// e.g., GetComponent<Animator>()?.SetTrigger("attack");
}
}