mirror of
https://github.com/ryzij/Cube-Tower-Defense.git
synced 2026-07-14 01:56:57 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(TowerHealth))]
|
||||
public class Tower : MonoBehaviour
|
||||
{
|
||||
private TowerHealth _towerHealth;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_towerHealth = GetComponent<TowerHealth>();
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.TryGetComponent(out Enemy enemy))
|
||||
_towerHealth.TakeDamage(enemy.Damage);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user