rabidus-test/Assets/Scripts/EnergyItem.cs

24 lines
476 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnergyItem : BaseItem
{
[SerializeField]
private float _energy = 1;
private EnergyController _energyController;
protected override void Awake()
{
base.Awake();
_energyController = FindObjectOfType<EnergyController>();
}
public override void Interact()
{
base.Interact();
_energyController.Energy += _energy;
}
}