using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Restaurant : MonoBehaviour { public Transform restaurantSwitch; private bool isSwitchOn = false; public Transform mainDoor; public Transform[] guestNpc; public GameObject[] mainLight; public void RestaurantSwitchOnOff() { if (!isSwitchOn) { restaurantSwitch.rotation *= Quaternion.Euler(0, 0, -90); isSwitchOn = true; foreach (var light in mainLight) { light.SetActive(true); } var door = mainDoor.GetComponent(); door._animator.SetBool("Open", true); } else { restaurantSwitch.rotation *= Quaternion.Euler(0, 0, 90); isSwitchOn = false; foreach (var light in mainLight) { light.SetActive(false); } var door = mainDoor.GetComponent(); door._animator.SetBool("Open", false); } } }