FantasyAsset/Assets/Scripts/Behvaiours/ProjectileDamage.cs
TG9six bb58f5ed86 Visual Changes
Added NPCs for wave, added animations, added impact vfx for fireball
2025-09-02 20:39:37 +04:00

22 lines
504 B
C#

// ProjectileDamage.cs
using UnityEngine;
public class ProjectileDamage : MonoBehaviour
{
public float damage = 10f;
private void Start()
{
this.gameObject.GetComponent<SpawnHitVFX>().go = this.gameObject;
}
void OnTriggerEnter(Collider other)
{
if (other.TryGetComponent<IDamageable>(out var target))
{
this.gameObject.GetComponent<SpawnHitVFX>().Impact();
target.ApplyDamage(damage);
}
Destroy(gameObject);
}
}