Implement health modification on enemy kill; add HealOnKillModifier and update death behavior
This commit is contained in:
30
Assets/Scripts/Systems/EnemyWeaponTargetSetter.cs
Normal file
30
Assets/Scripts/Systems/EnemyWeaponTargetSetter.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Weapons;
|
||||
|
||||
namespace Systems
|
||||
{
|
||||
public class EnemyWeaponTargetSetter : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private List<AutoWeapon> weapons = new();
|
||||
[SerializeField] private Transform target;
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
if (weapons.Count == 0)
|
||||
{
|
||||
weapons = new List<AutoWeapon>(GetComponentsInChildren<AutoWeapon>());
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!target || weapons.Count == 0) return;
|
||||
|
||||
foreach (var weapon in weapons)
|
||||
{
|
||||
weapon.Target = target.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user