using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class RoomInspection : MonoBehaviour
{
public static RoomInspection Inst;
private void Awake()
{
Inst = this;
}
// Start is called before the first frame update
void Start()
{
ExtendedFlycam.Inst.peiDianShiD.SetActive(false);
ExtendedFlycam.Inst.jiFangD.SetActive(false);
}
// Update is called once per frame
void Update()
{
}
public void OnTriggerEnter(Collider other)
{
displayRoof(other.gameObject);
}
public void OnTriggerExit(Collider other)
{
hideRoof(other.gameObject);
}
///
/// ÏÔʾÎݶ¥
///
public void displayRoof(GameObject other)
{
//Debug.Log(other.gameObject.name);
//if (other.gameObject != Camera.main.gameObject)
if (other != Camera.main.gameObject)
return;
if (ExtendedFlycam.Inst.room == ExtendedFlycam.Room.None)
{
if (ExtendedFlycam.Inst.jiFang[1].activeInHierarchy && ExtendedFlycam.Inst.peiDianShi[1].activeInHierarchy)
{
ExtendedFlycam.Inst.peiDianShiD.SetActive(true);
ExtendedFlycam.Inst.jiFangD.SetActive(true);
}
}
else if (ExtendedFlycam.Inst.room == ExtendedFlycam.Room.»ú·¿)
{
if (ExtendedFlycam.Inst.jiFang[1].activeInHierarchy)
{
ExtendedFlycam.Inst.peiDianShiD.SetActive(false);
ExtendedFlycam.Inst.jiFangD.SetActive(true);
}
}
else if (ExtendedFlycam.Inst.room == ExtendedFlycam.Room.ÅäµçÊÒ)
{
if (ExtendedFlycam.Inst.peiDianShi[1].activeInHierarchy)
{
ExtendedFlycam.Inst.peiDianShiD.SetActive(true);
ExtendedFlycam.Inst.jiFangD.SetActive(false);
}
}
}
///
/// Òþ²ØÎݶ¥
///
public void hideRoof(GameObject other)
{
//Debug.Log(other.gameObject.name);
//if (other.gameObject != Camera.main.gameObject)
if (other != Camera.main.gameObject)
return;
ExtendedFlycam.Inst.peiDianShiD.SetActive(false);
ExtendedFlycam.Inst.jiFangD.SetActive(false);
}
}