Cute_demon_attacks/meng_yao/Assets/script/A_Fight/cardBox.cs
2024-12-09 23:24:46 +08:00

39 lines
976 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class cardBox : MonoBehaviour
{
public static cardBox instance;
[Header("萌妖数量")] public int mengyaoNumber=0;
[HideInInspector] public int inPlaceNumber=0;
[Header("开始按钮obj")] public GameObject btnObj;
private void Awake()
{
instance = this;
if (btnObj==null)
{
Debug.LogError("btnObj==null");
return;
}
btnObj.SetActive(false);
}
public void ChangeInPlaceNumber(int number)
{
inPlaceNumber += number;
if (inPlaceNumber== mengyaoNumber)
{
gameGlobal.GameStart();
Debug.Log("布置完成");
btnObj.SetActive(true);
btnObj.GetComponent<Button>().onClick.AddListener(() => {
gameGlobal.GamePlay();
btnObj.SetActive(false);
});
}
}
}