You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
631 B
37 lines
631 B
using Ai; |
|
using UnityEngine; |
|
|
|
namespace Meta |
|
{ |
|
[RequireComponent(typeof(Body))] |
|
public class EnemyDrop : MonoBehaviour |
|
{ |
|
[SerializeField] private int _exp; |
|
[SerializeField] private int _coins; |
|
[SerializeField] private Body _body; |
|
|
|
private void Awake() |
|
{ |
|
if (_body != null) |
|
_body.DeathEvent += Drop; |
|
} |
|
|
|
private void OnDisable() |
|
{ |
|
if (_body != null) |
|
_body.DeathEvent -= Drop; |
|
} |
|
|
|
private void Drop() |
|
{ |
|
PlayerResources.Instance.AddExp(_exp); |
|
PlayerResources.Instance.AddCoins(_coins); |
|
} |
|
|
|
private void OnValidate() |
|
{ |
|
if (_body == null) |
|
_body = GetComponent<Body>(); |
|
} |
|
} |
|
}
|
|
|