using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class vegetablesControl : MonoBehaviour
{

    public GameObject VeOBj;
    private float timer = 0;

    public Color endColor;

    private Material mesh;
    void Start()
    {
        mesh = VeOBj.GetComponent<MeshRenderer>().material;   
    }

  
    void Update()
    {
        
    }
  
    private void OnTriggerStay(Collider other)
    {
        if (other.tag=="Player") 
        {
            timer += Time.deltaTime;
            if (timer>=2F) 
            {
                mesh.color = Color.Lerp(mesh.color,endColor,1*Time.deltaTime);
               
            }
        }
    }
}
