using System.Collections;
using UnityEngine;
/// <summary>
/// Gère la production de ressource et sert de minuteur pour laisser la ressource sur le sol.
/// </summary>
public class ResourceMaker : MonoBehaviour
{
    [SerializeField] 
    private int _resourceMakingAmount;
    [SerializeField] 
    private ResourceManager.ResourceChoice _resourceChoice;
    private ResourceManager _resourceManagerInstance;

    private void Awake()
    {
        _resourceManagerInstance = ResourceManager.Instance;
    }

    /// <summary>
    /// D'après le choix de resource à générer, choisi le prefab à instancier
    /// </summary>
    public void GenerateResource()
    {
        switch (_resourceChoice)
        {
            case ResourceManager.ResourceChoice.Rock:
                _resourceManagerInstance.RockAmount = _resourceMakingAmount;
                break;
            case ResourceManager.ResourceChoice.Wood:
                _resourceManagerInstance.WoodAmount = _resourceMakingAmount;
                break;
            case ResourceManager.ResourceChoice.Food:
                _resourceManagerInstance.FoodAmount = _resourceMakingAmount;
                break;
        }
        Destroy(gameObject);
    }
}
