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