2021-01-10 18:34:30 +01:00
|
|
|
using System;
|
2021-01-10 18:15:58 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using Weapons.Scripts;
|
2021-01-10 18:34:30 +01:00
|
|
|
using Random = UnityEngine.Random;
|
2021-01-10 18:15:58 +01:00
|
|
|
|
|
|
|
public class AddScoreOnDie : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField] private ulong value = 100;
|
|
|
|
private EntityHealth _health;
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
_health = GetComponent<EntityHealth>();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnEnable()
|
|
|
|
{
|
|
|
|
_health.Die += Die;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnDisable()
|
|
|
|
{
|
|
|
|
_health.Die -= Die;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Die()
|
|
|
|
{
|
|
|
|
Score.Value += value + (ulong)Random.Range(-5, 5);
|
|
|
|
}
|
|
|
|
}
|