자원소모 시스템 작업 완료

This commit is contained in:
김판돌 2023-11-05 19:45:34 +09:00
parent e3952bcef9
commit 0f3d7535cb
13 changed files with 40 additions and 4 deletions

View File

@ -54,7 +54,27 @@ public class BuildingCtrl : MonoBehaviour
Debug.Log("건물이 최대 레벨 입니다."); Debug.Log("건물이 최대 레벨 입니다.");
return; return;
} }
if (!isProduction)
{
if(unitInfo.unit.buy[buildingLevel] > PlayCtrl.Instance.money)
{
Debug.Log("구매비용이 부족합니다");
if (buildingLevel == 0)
DeletBuilding();
return;
}
PlayCtrl.Instance.TextUpdate(-unitInfo.unit.buy[buildingLevel]);
PlayCtrl.Instance.player.buildings[lineCount].units.Add(unitInfo); PlayCtrl.Instance.player.buildings[lineCount].units.Add(unitInfo);
} else
{
if(500 * buildingLevel > PlayCtrl.Instance.money)
{
Debug.Log("구매비용이 부족합니다");
return;
}
PlayCtrl.Instance.TextUpdate(-500 * buildingLevel);
PlayCtrl.Instance.player.addMoney[lineCount] += 100;
}
buildingLevel++; buildingLevel++;
} }

View File

@ -7,8 +7,7 @@ public class SummonsUnit : MonoBehaviour
public List<BuildingInfo> buildings; public List<BuildingInfo> buildings;
public int campHp; public int campHp;
//테스트용도 public int[] addMoney;
public UnitCtrl unit;
private void Awake() private void Awake()
{ {
@ -19,6 +18,11 @@ public class SummonsUnit : MonoBehaviour
buildings.Add(new BuildingInfo()); buildings.Add(new BuildingInfo());
buildings.Add(new BuildingInfo()); buildings.Add(new BuildingInfo());
buildings.Add(new BuildingInfo()); buildings.Add(new BuildingInfo());
addMoney = new int[5];
for(int n = 0; n < addMoney.Length; n++)
{
addMoney[n] = 100;
}
} }
private void Start() private void Start()
@ -58,7 +62,7 @@ public class SummonsUnit : MonoBehaviour
} }
if (!isEnemy)//자원 생성 if (!isEnemy)//자원 생성
{ {
PlayCtrl.Instance.TextUpdate(100); PlayCtrl.Instance.TextUpdate(addMoney[count]);
} }
} }
} }

View File

@ -9,4 +9,5 @@ public class UnitInfo
public float attackSpeed; public float attackSpeed;
public int defense; public int defense;
public float moveSpeed; public float moveSpeed;
public int[] buy;
} }

View File

@ -121,6 +121,8 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
if (money != int.Parse(moneyText.text)) if (money != int.Parse(moneyText.text))
Debug.LogError("버그발견"); Debug.LogError("버그발견");
money += addMoney; money += addMoney;
if(money < 0 || money > 999900)
Debug.LogError("가격버그발견");
moneyText.text = money.ToString(); moneyText.text = money.ToString();
} }
} }

View File

@ -55,6 +55,7 @@ MonoBehaviour:
attackSpeed: 2 attackSpeed: 2
defense: 0 defense: 0
moveSpeed: 5 moveSpeed: 5
buy: 320000006400000096000000c8000000fa000000
anim: {fileID: 95137492731099486} anim: {fileID: 95137492731099486}
defensObj: {fileID: 6875975714746273136} defensObj: {fileID: 6875975714746273136}
isEnemy: 0 isEnemy: 0

View File

@ -879,6 +879,7 @@ MonoBehaviour:
attackSpeed: 2 attackSpeed: 2
defense: 20 defense: 20
moveSpeed: 5 moveSpeed: 5
buy: 64000000c80000002c01000090010000f4010000
anim: {fileID: 95025121907886038} anim: {fileID: 95025121907886038}
defensObj: {fileID: 2560953789813459005} defensObj: {fileID: 2560953789813459005}
isEnemy: 0 isEnemy: 0

View File

@ -2624,6 +2624,7 @@ MonoBehaviour:
attackSpeed: 3 attackSpeed: 3
defense: 50 defense: 50
moveSpeed: 6 moveSpeed: 6
buy: c8000000900100005802000020030000e8030000
anim: {fileID: 95139002667318946} anim: {fileID: 95139002667318946}
defensObj: {fileID: 689331061546745630} defensObj: {fileID: 689331061546745630}
isEnemy: 0 isEnemy: 0

View File

@ -992,6 +992,7 @@ MonoBehaviour:
attackSpeed: 2 attackSpeed: 2
defense: 50 defense: 50
moveSpeed: 3 moveSpeed: 3
buy: 320000006400000096000000c8000000fa000000
anim: {fileID: 95921515561157426} anim: {fileID: 95921515561157426}
defensObj: {fileID: 4728842467067653097} defensObj: {fileID: 4728842467067653097}
isEnemy: 0 isEnemy: 0

View File

@ -1195,6 +1195,7 @@ MonoBehaviour:
attackSpeed: 2 attackSpeed: 2
defense: 100 defense: 100
moveSpeed: 3 moveSpeed: 3
buy: 64000000c80000002c01000090010000f4010000
anim: {fileID: 95699734256526290} anim: {fileID: 95699734256526290}
defensObj: {fileID: 358225386609479139} defensObj: {fileID: 358225386609479139}
isEnemy: 0 isEnemy: 0

View File

@ -2410,6 +2410,7 @@ MonoBehaviour:
attackSpeed: 2 attackSpeed: 2
defense: 150 defense: 150
moveSpeed: 3 moveSpeed: 3
buy: c8000000900100005802000020030000e8030000
anim: {fileID: 95057529936190960} anim: {fileID: 95057529936190960}
defensObj: {fileID: 1996079076997718765} defensObj: {fileID: 1996079076997718765}
isEnemy: 0 isEnemy: 0

View File

@ -171,6 +171,7 @@ MonoBehaviour:
attackSpeed: 2 attackSpeed: 2
defense: 10 defense: 10
moveSpeed: 3 moveSpeed: 3
buy: 320000006400000096000000c8000000fa000000
anim: {fileID: 95900925144019084} anim: {fileID: 95900925144019084}
defensObj: {fileID: 1912811255609939500} defensObj: {fileID: 1912811255609939500}
isEnemy: 0 isEnemy: 0

View File

@ -1067,6 +1067,7 @@ MonoBehaviour:
attackSpeed: 2 attackSpeed: 2
defense: 30 defense: 30
moveSpeed: 3 moveSpeed: 3
buy: 64000000c80000002c01000090010000f4010000
anim: {fileID: 95649635967823240} anim: {fileID: 95649635967823240}
defensObj: {fileID: 209849273209592232} defensObj: {fileID: 209849273209592232}
isEnemy: 0 isEnemy: 0

View File

@ -2740,6 +2740,7 @@ MonoBehaviour:
attackSpeed: 3 attackSpeed: 3
defense: 100 defense: 100
moveSpeed: 3 moveSpeed: 3
buy: c8000000900100005802000020030000e8030000
anim: {fileID: 95893142771630846} anim: {fileID: 95893142771630846}
defensObj: {fileID: 3031819780035806523} defensObj: {fileID: 3031819780035806523}
isEnemy: 0 isEnemy: 0