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

public class SwitchClose : MonoBehaviour {

    public GameObject thingToClose;

    void Start()
    {
        thingToClose.GetComponent<Collider>().enabled = false;
        thingToClose.GetComponent<Renderer>().enabled = false;
    }

    void OnTriggerEnter(Collider col)
    {
        thingToClose.GetComponent<Collider>().enabled = true;
        thingToClose.GetComponent<Renderer>().enabled = true;
    }

    void OnTriggerExit(Collider col)
    {
        thingToClose.GetComponent<Collider>().enabled = false;
        thingToClose.GetComponent<Renderer>().enabled = false;
    }
}
