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

namespace MPStudio
{
    public class AutoSwitch : MonoBehaviour
    {
        private SwitchSp sp;

        public float cd=1;
        private float timer=0;
        
        private void Awake()
        {
            sp = GetComponent<SwitchSp>();
        }

        private void FixedUpdate()
        {
            timer += Time.fixedDeltaTime;

            if (timer >= cd)
            {
                sp.isOpen = !sp.isOpen;
                timer = 0;
            }
        }
    }
}