mirror of
https://github.com/ryzij/Cube-Tower-Defense.git
synced 2026-07-14 01:56:57 +00:00
Добавил возможность отслеживать спавн и уничтожение врагов
This commit is contained in:
+10
-1
@@ -11,6 +11,7 @@ public class Enemy : MonoBehaviour
|
||||
[SerializeField] private int _killReward = 10;
|
||||
[SerializeField] private UnityEvent<float> _onHealthChanged;
|
||||
[SerializeField] private UnityEvent<OnEnemyDeathEventArgs> _onDeath;
|
||||
[SerializeField] private UnityEvent _onDestroyed;
|
||||
|
||||
private Queue<Vector3> _path;
|
||||
private Vector3 _target;
|
||||
@@ -26,7 +27,13 @@ public class Enemy : MonoBehaviour
|
||||
add => _onDeath.AddListener(value);
|
||||
remove => _onDeath.RemoveListener(value);
|
||||
}
|
||||
|
||||
|
||||
public event UnityAction OnDestroyed
|
||||
{
|
||||
add => _onDestroyed.AddListener(value);
|
||||
remove => _onDestroyed.RemoveListener(value);
|
||||
}
|
||||
|
||||
public SandPathBuildService PathBuildService
|
||||
{
|
||||
get => _pathService;
|
||||
@@ -82,6 +89,8 @@ public class Enemy : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy() => _onDestroyed?.Invoke();
|
||||
|
||||
public class OnEnemyDeathEventArgs
|
||||
{
|
||||
public int KillReward { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user