게임 한사이클 50% 완료
This commit is contained in:
parent
bed3f2d9fd
commit
42e61f4d81
|
|
@ -1,6 +1,5 @@
|
||||||
using MEC;
|
using MEC;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Unity.VisualScripting;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
|
@ -55,6 +54,7 @@ public class BuildingCtrl : MonoBehaviour
|
||||||
Debug.Log("건물이 최대 레벨 입니다.");
|
Debug.Log("건물이 최대 레벨 입니다.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
PlayCtrl.Instance.player.buildings[lineCount].units.Add(unitInfo);
|
||||||
buildingLevel++;
|
buildingLevel++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,6 +76,6 @@ public class BuildingCtrl : MonoBehaviour
|
||||||
this.unitInfo = unitInfo;
|
this.unitInfo = unitInfo;
|
||||||
img.sprite = unitImg;
|
img.sprite = unitImg;
|
||||||
img.color = Color.white;
|
img.color = Color.white;
|
||||||
buildingLevel++;
|
LevelUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ public class SummonsUnit : MonoBehaviour
|
||||||
{
|
{
|
||||||
public bool isEnemy;
|
public bool isEnemy;
|
||||||
public List<BuildingInfo> buildings;
|
public List<BuildingInfo> buildings;
|
||||||
|
public int campHp;
|
||||||
|
|
||||||
//테스트용도
|
//테스트용도
|
||||||
public UnitCtrl unit;
|
public UnitCtrl unit;
|
||||||
|
|
@ -12,7 +13,7 @@ public class SummonsUnit : MonoBehaviour
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
buildings = new List<BuildingInfo>();
|
buildings = new List<BuildingInfo>();
|
||||||
|
campHp = 500;
|
||||||
buildings.Add(new BuildingInfo());
|
buildings.Add(new BuildingInfo());
|
||||||
buildings.Add(new BuildingInfo());
|
buildings.Add(new BuildingInfo());
|
||||||
buildings.Add(new BuildingInfo());
|
buildings.Add(new BuildingInfo());
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ public class UnitCtrl : MonoBehaviour
|
||||||
}
|
}
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
|
if (PlayCtrl.Instance.isEndGame)
|
||||||
|
return;
|
||||||
delay -= Time.deltaTime;
|
delay -= Time.deltaTime;
|
||||||
if (delay > 0)
|
if (delay > 0)
|
||||||
return;
|
return;
|
||||||
|
|
@ -37,7 +39,22 @@ public class UnitCtrl : MonoBehaviour
|
||||||
if (enemyUnits.Count == 0)
|
if (enemyUnits.Count == 0)
|
||||||
{
|
{
|
||||||
anim.SetTrigger("att");
|
anim.SetTrigger("att");
|
||||||
Debug.Log("캠프 공격");
|
if (isEnemy)
|
||||||
|
{
|
||||||
|
PlayCtrl.Instance.player.campHp -= unit.attack;
|
||||||
|
if(PlayCtrl.Instance.player.campHp <= 0)
|
||||||
|
{
|
||||||
|
PlayCtrl.Instance.isEndGame = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlayCtrl.Instance.enemy.campHp -= unit.attack;
|
||||||
|
if (PlayCtrl.Instance.enemy.campHp <= 0)
|
||||||
|
{
|
||||||
|
PlayCtrl.Instance.isEndGame = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
delay = unit.attackSpeed;
|
delay = unit.attackSpeed;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
|
||||||
public SummonsUnit player;
|
public SummonsUnit player;
|
||||||
public SummonsUnit enemy;
|
public SummonsUnit enemy;
|
||||||
public BuildingCtrl buildingCtrl;
|
public BuildingCtrl buildingCtrl;
|
||||||
|
public bool isEndGame;
|
||||||
|
|
||||||
//선택된 ui의 정보를 저장할 수 있게 만들기.
|
//선택된 ui의 정보를 저장할 수 있게 만들기.
|
||||||
//레벨업 ui만들기
|
//레벨업 ui만들기
|
||||||
|
|
@ -36,6 +37,7 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
|
||||||
summons = 0.1f;
|
summons = 0.1f;
|
||||||
slider.value = 0;
|
slider.value = 0;
|
||||||
stage = 0;
|
stage = 0;
|
||||||
|
isEndGame = false;
|
||||||
uiExit();
|
uiExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,6 +52,11 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
|
||||||
}
|
}
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
|
if (isEndGame)
|
||||||
|
{
|
||||||
|
Debug.Log("게임종료");
|
||||||
|
return;
|
||||||
|
}
|
||||||
float deltaTime = Time.deltaTime;
|
float deltaTime = Time.deltaTime;
|
||||||
camera.transform.position += Vector3.left * speed * deltaTime * move;
|
camera.transform.position += Vector3.left * speed * deltaTime * move;
|
||||||
if (camera.transform.position.x < -40)
|
if (camera.transform.position.x < -40)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue