Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using TMPro;
  6. using UnityEngine.UI;
  7.  
  8. public class HarvestNode : Interactable {
  9.  
  10.  
  11.     [SerializeField]
  12.     private int minAmount;
  13.     [SerializeField]
  14.     private int maxAmount;
  15.     [SerializeField]
  16.     private float timeToHarvest = 2f;
  17.     [SerializeField]
  18.     private bool isInteracted = false;
  19.  
  20.     private float harvestingtime = 0f;
  21.  
  22.     [SerializeField]  private TextMeshProUGUI harvestBar;
  23.     public GameObject droppedObject;
  24.  
  25.     public override void Interact()
  26.     {
  27.         base.Interact();
  28.  
  29.         Harvest();
  30.     }
  31.  
  32.     private void Harvest()
  33.     {
  34.         isInteracted = true;
  35.     }
  36.  
  37.     private void Update()
  38.     {
  39.         if(isInteracted)
  40.             Destroy(gameObject);
  41.     }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement