2023-07-28 11:48:57 +03:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2023-08-01 11:28:14 +03:00
|
|
|
public class EnergyItem : MonoBehaviour, IInteractable
|
2023-07-28 11:48:57 +03:00
|
|
|
{
|
|
|
|
[SerializeField]
|
|
|
|
private float _energy = 1;
|
|
|
|
|
|
|
|
private EnergyController _energyController;
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
_energyController = FindObjectOfType<EnergyController>();
|
|
|
|
}
|
|
|
|
|
2023-08-01 11:28:14 +03:00
|
|
|
public void Interact()
|
2023-07-28 11:48:57 +03:00
|
|
|
{
|
|
|
|
_energyController.Energy += _energy;
|
|
|
|
Destroy(gameObject);
|
|
|
|
}
|
|
|
|
}
|