Skip to content
Snippets Groups Projects
CharacterInteractable.cs 601 B
Newer Older
using UnityEngine;
using System.Collections ;

public class CharacterInteractable : MonoBehaviour
{
    public GameObject ToEnable ;
    public float TimeActivate = 5.0f ;

    // Start is called before the first frame update
    public void Interact()
    {
        // TODO
        if (!ToEnable.activeSelf)
        {
            StartCoroutine(CoroutineActivate());
        }
    }
    
    public IEnumerator CoroutineActivate()
    {
        ToEnable.SetActive(true);
        yield return new WaitForSeconds(TimeActivate);
        ToEnable.SetActive(false);
    }
    
}