using UnityEngine; /// /// Harvestable represents the base class of all harvestable objects in the scene and inherits of "Interactable.cs" /// public abstract class Harvestable : Interactable { [Header("Harvestable Properties")] [Tooltip("The time for how long the object needs to be harvested.")] [Range(0.1f, 99.9f)] [SerializeField] float harvestDuration = 3f; float harvestTime = 0f;// time for how long the player already "harvested" the object /// /// IncreaseHarvestTime increases the harvestTime by Time.deltaTime. /// harvestTime += Time.deltaTime; /// public void IncreaseHarvestTime() => harvestTime += Time.deltaTime; /// /// ResetHarvestTime resets the harvestTime to 0f. /// public void ResetHarvestTime() => harvestTime = 0f; /// /// GetHarvestTime gets the time for how long the player has already "harvested". /// /// A float of the time for how long the player has already "harvested" public float GetHarvestTime() => harvestTime; /// /// GetHarvestTimeLeft gets the time for how long a player still has to "harvest". /// /// A float containig the result of harvestDuration - harvestTime public float GetHarvestTimeLeft() => harvestDuration - harvestTime; /// /// GetHarvestDuration gets the time for how long the object needs to be harvested until the interact method triggers. /// /// A float of the time for how long the object needs to be harvested until the interact method triggers public float GetHarvestDuration() => harvestDuration; }