rabidus-test/Assets/Scripts/EnergyItem.cs

24 lines
476 B
C#
Raw Permalink Normal View History

2023-07-28 11:48:57 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2023-08-15 17:38:54 +03:00
public class EnergyItem : BaseItem
2023-07-28 11:48:57 +03:00
{
[SerializeField]
private float _energy = 1;
private EnergyController _energyController;
2023-08-22 15:41:12 +03:00
protected override void Awake()
2023-07-28 11:48:57 +03:00
{
2023-08-22 15:41:12 +03:00
base.Awake();
2023-07-28 11:48:57 +03:00
_energyController = FindObjectOfType<EnergyController>();
}
2023-08-15 17:38:54 +03:00
public override void Interact()
2023-07-28 11:48:57 +03:00
{
2023-08-15 17:38:54 +03:00
base.Interact();
2023-07-28 11:48:57 +03:00
_energyController.Energy += _energy;
}
}