46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using MEC;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
public class BuildingCtrl : MonoBehaviour
|
|
{
|
|
public bool isProduction;
|
|
public int lineCount;
|
|
public int buildingLevel;
|
|
|
|
private void Start()
|
|
{
|
|
Timing.RunCoroutine(BuildingSet());
|
|
}
|
|
private IEnumerator<float> BuildingSet()
|
|
{
|
|
yield return Timing.WaitForSeconds(0.1f);
|
|
//ui재정렬
|
|
RectTransform rt = gameObject.GetComponent<RectTransform>();
|
|
RectTransform changeRt = gameObject.GetComponentsInChildren<RectTransform>()[1];
|
|
float sizeSet = (rt.sizeDelta.y / 2) - 10;
|
|
changeRt.offsetMin = new Vector2(-sizeSet, 10.0f);
|
|
changeRt.offsetMax = new Vector2(sizeSet, -10.0f);
|
|
|
|
//나의정보 playerCtrl에 전달
|
|
//PlayCtrl.Instance.player.buildings[lineCount].
|
|
}
|
|
|
|
public void Button()
|
|
{
|
|
if(isProduction || buildingLevel != 0)//생산건물 이거나 일반건물 레벨업
|
|
{
|
|
PlayCtrl.Instance.buildingLevelupUI.SetActive(true);
|
|
PlayCtrl.Instance.newBuildingUI.SetActive(false);
|
|
PlayCtrl.Instance.backButton.SetActive(true);
|
|
}
|
|
else //신규건물 생산
|
|
{
|
|
PlayCtrl.Instance.buildingLevelupUI.SetActive(false);
|
|
PlayCtrl.Instance.newBuildingUI.SetActive(true);
|
|
PlayCtrl.Instance.backButton.SetActive(true);
|
|
}
|
|
}
|
|
}
|