2023-08-15 17:38:54 +03:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class BaseItem : MonoBehaviour, IInteractable
|
|
|
|
|
{
|
|
|
|
|
[SerializeField]
|
|
|
|
|
private float _scoreAdd = 0;
|
|
|
|
|
|
2023-08-22 15:41:12 +03:00
|
|
|
|
protected ScoreController _scoreController;
|
|
|
|
|
|
|
|
|
|
protected virtual void Awake()
|
|
|
|
|
{
|
|
|
|
|
_scoreController = FindObjectOfType<ScoreController>();
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-15 17:38:54 +03:00
|
|
|
|
public virtual void Interact()
|
|
|
|
|
{
|
2023-08-22 15:41:12 +03:00
|
|
|
|
if (_scoreAdd > 0)
|
|
|
|
|
_scoreController.AddScore(_scoreAdd, true);
|
|
|
|
|
|
2023-08-15 17:38:54 +03:00
|
|
|
|
Destroy(gameObject);
|
|
|
|
|
}
|
|
|
|
|
}
|