유닛 생산 건물 생성작업 완료
This commit is contained in:
parent
fb3e6738a4
commit
bed3f2d9fd
File diff suppressed because it is too large
Load Diff
|
|
@ -2,6 +2,7 @@ using MEC;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class BuildingCtrl : MonoBehaviour
|
public class BuildingCtrl : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -9,6 +10,10 @@ public class BuildingCtrl : MonoBehaviour
|
||||||
public int lineCount;
|
public int lineCount;
|
||||||
public int buildingLevel;
|
public int buildingLevel;
|
||||||
|
|
||||||
|
UnitCtrl unitInfo;
|
||||||
|
|
||||||
|
Image img;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
Timing.RunCoroutine(BuildingSet());
|
Timing.RunCoroutine(BuildingSet());
|
||||||
|
|
@ -19,12 +24,10 @@ public class BuildingCtrl : MonoBehaviour
|
||||||
//uiÀçÁ¤·Ä
|
//uiÀçÁ¤·Ä
|
||||||
RectTransform rt = gameObject.GetComponent<RectTransform>();
|
RectTransform rt = gameObject.GetComponent<RectTransform>();
|
||||||
RectTransform changeRt = gameObject.GetComponentsInChildren<RectTransform>()[1];
|
RectTransform changeRt = gameObject.GetComponentsInChildren<RectTransform>()[1];
|
||||||
|
img = changeRt.GetComponent<Image>();
|
||||||
float sizeSet = (rt.sizeDelta.y / 2) - 10;
|
float sizeSet = (rt.sizeDelta.y / 2) - 10;
|
||||||
changeRt.offsetMin = new Vector2(-sizeSet, 10.0f);
|
changeRt.offsetMin = new Vector2(-sizeSet, 10.0f);
|
||||||
changeRt.offsetMax = new Vector2(sizeSet, -10.0f);
|
changeRt.offsetMax = new Vector2(sizeSet, -10.0f);
|
||||||
|
|
||||||
//나의정보 playerCtrl에 전달
|
|
||||||
//PlayCtrl.Instance.player.buildings[lineCount].
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Button()
|
public void Button()
|
||||||
|
|
@ -41,5 +44,38 @@ public class BuildingCtrl : MonoBehaviour
|
||||||
PlayCtrl.Instance.newBuildingUI.SetActive(true);
|
PlayCtrl.Instance.newBuildingUI.SetActive(true);
|
||||||
PlayCtrl.Instance.backButton.SetActive(true);
|
PlayCtrl.Instance.backButton.SetActive(true);
|
||||||
}
|
}
|
||||||
|
//나의 정보를 PlayCtrl에 전달후 특정 상황이 되면 상호작용 하게 만들기
|
||||||
|
PlayCtrl.Instance.buildingCtrl = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LevelUp()
|
||||||
|
{
|
||||||
|
if (buildingLevel >= 5)
|
||||||
|
{
|
||||||
|
Debug.Log("건물이 최대 레벨 입니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
buildingLevel++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeletBuilding()
|
||||||
|
{
|
||||||
|
if (isProduction)
|
||||||
|
{
|
||||||
|
Debug.Log("생산건물은 파괴할 수 없습니다.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
unitInfo = null;
|
||||||
|
img.sprite = null;
|
||||||
|
img.color = Color.clear;
|
||||||
|
buildingLevel = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NewBuilding(UnitCtrl unitInfo, Sprite unitImg )
|
||||||
|
{
|
||||||
|
this.unitInfo = unitInfo;
|
||||||
|
img.sprite = unitImg;
|
||||||
|
img.color = Color.white;
|
||||||
|
buildingLevel++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,12 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
|
||||||
public GameObject newBuildingUI;
|
public GameObject newBuildingUI;
|
||||||
public GameObject buildingLevelupUI;
|
public GameObject buildingLevelupUI;
|
||||||
public GameObject backButton;
|
public GameObject backButton;
|
||||||
|
public UnitCtrl[] units;
|
||||||
|
public Sprite[] unitImages;
|
||||||
|
|
||||||
public SummonsUnit player;
|
public SummonsUnit player;
|
||||||
public SummonsUnit enemy;
|
public SummonsUnit enemy;
|
||||||
|
public BuildingCtrl buildingCtrl;
|
||||||
|
|
||||||
//선택된 ui의 정보를 저장할 수 있게 만들기.
|
//선택된 ui의 정보를 저장할 수 있게 만들기.
|
||||||
//레벨업 ui만들기
|
//레벨업 ui만들기
|
||||||
|
|
@ -79,6 +82,24 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
|
||||||
newBuildingUI.SetActive(false);
|
newBuildingUI.SetActive(false);
|
||||||
buildingLevelupUI.SetActive(false);
|
buildingLevelupUI.SetActive(false);
|
||||||
backButton.SetActive(false);
|
backButton.SetActive(false);
|
||||||
|
buildingCtrl = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SelectUnit(int count)
|
||||||
|
{
|
||||||
|
buildingCtrl.NewBuilding(units[count], unitImages[count]);
|
||||||
|
uiExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteBuilding()
|
||||||
|
{
|
||||||
|
buildingCtrl.DeletBuilding();
|
||||||
|
uiExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LevelUpBuilding()
|
||||||
|
{
|
||||||
|
buildingCtrl.LevelUp();
|
||||||
|
uiExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue