26 lines
545 B
C#
26 lines
545 B
C#
using UnityEngine;
|
|
|
|
public class BaseItem : MonoBehaviour, IInteractable
|
|
{
|
|
[SerializeField]
|
|
private float _scoreAdd = 0;
|
|
[SerializeField]
|
|
private bool _selfDestroy = true;
|
|
|
|
protected ScoreController _scoreController;
|
|
|
|
protected virtual void Awake()
|
|
{
|
|
_scoreController = FindObjectOfType<ScoreController>();
|
|
}
|
|
|
|
public virtual void Interact()
|
|
{
|
|
if (_scoreAdd > 0)
|
|
_scoreController.AddScore(_scoreAdd, true);
|
|
|
|
if (_selfDestroy)
|
|
Destroy(gameObject);
|
|
}
|
|
}
|