52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
public class AllHouseContro : MonoBehaviour
|
|
{
|
|
public List<HouseBtn> HouseBtnList=new List<HouseBtn>();
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
public void ControAllDoorOpen()
|
|
{
|
|
|
|
for (int i=0;i<HouseBtnList.Count;i++)
|
|
{
|
|
if (!HouseBtnList[i].DoorIsOpen)
|
|
{
|
|
Tools.MoveUpOrDwon(HouseBtnList[i].door,270);
|
|
HouseBtnList[i].DoorIsOpen = true;
|
|
}
|
|
|
|
}
|
|
}
|
|
public void ControAllDoorClose()
|
|
{
|
|
for (int i = 0; i < HouseBtnList.Count; i++)
|
|
{
|
|
if (HouseBtnList[i].DoorIsOpen)
|
|
{
|
|
Tools.MoveUpOrDwon(HouseBtnList[i].door, -270);
|
|
HouseBtnList[i].DoorIsOpen = false;
|
|
}
|
|
|
|
}
|
|
}
|
|
public void ControOneDoorOpen(int id,System.Action onComplete = null)
|
|
{
|
|
Tools.MoveUpOrDwon(HouseBtnList[id-1].door, 270,onComplete);
|
|
HouseBtnList[id-1].DoorIsOpen = true;
|
|
}
|
|
|
|
public void ControOneDoorClose(int id, System.Action onComplete = null)
|
|
{
|
|
Tools.MoveUpOrDwon(HouseBtnList[id - 1].door, -270, onComplete);
|
|
HouseBtnList[id - 1].DoorIsOpen = false;
|
|
}
|
|
}
|