Files
AZTECH_WB/Assets/Scripts/Object/Building.cs
정영민 aa08b5264e [정영민] 가상공장 기능 수정
26.03.17
- 미니맵 기능 수정
- 건물 기능 수정
- 설비 아이콘 기능 및 알람 기능 수정
2026-03-17 12:16:12 +09:00

58 lines
1.6 KiB
C#

using System.Collections.Generic;
using System.Linq;
using AZTECHWB.Core;
using UnityEngine;
namespace AZTECHWB
{
public class Building : MonoBehaviour
{
public List<Floor> floorList = new List<Floor>();
public List<Machine> machineList = new List<Machine>();
public Roof roof;
public bool isOnlyMachineFloorsEnabled;
public void Init()
{
roof = transform.GetComponentInChildren<Roof>(true);
machineList.Clear();
floorList.Clear();
var machines = GetComponentsInChildren<Machine>(true);
for (int i = 0; i < machines.Length; i++)
{
machines[i].Init();
machineList.Add(machines[i]);
}
var floor = GetComponentsInChildren<Floor>(true);
for (int i = 0; i < floor.Length; i++)
{
floorList.Add(floor[i]);
}
}
private void LateUpdate()
{
if (AZTECHAppMain.Instance.cameraController == null)
return;
var cam = AZTECHAppMain.Instance.cameraController;
isOnlyMachineFloorsEnabled = cam.IsCameraInsideBoundary() && cam.Camera.transform.localPosition.y < 20f ? true : false;
foreach(var floor in floorList)
{
if (floor.isEmptyFloor)
{
floor.gameObject.SetActive(!isOnlyMachineFloorsEnabled);
}
else
{
floor.gameObject.SetActive(isOnlyMachineFloorsEnabled);
}
}
}
}
}