public void SpawnUnit() { if (canSpawnIt) { if (gameManager.GetMoney() >= spawnMoney && canSpawnAgain) { nextTimeToSpawn = Time.time + (1 / spawnSpeed); int money = gameManager.GetMoney() - spawnMoney; gameManager.SetMoney(money); Vector2 a = spawnPosition.position; a.x -= 0.1f; if (!poolManager.Go(spawnThis.GetUnitID())) { Instantiate(spawnThis.gameObject, a, Quaternion.identity); } respawnMaxTime = nextTimeToSpawn - Time.time; respawnCurTime = 0f; canSpawnAgain = false; } else if (!canSpawnAgain) { Instantiate(haveToWaitMoreTimeText, stageManager.textSpawnPosition); } else { Instantiate(stageManager.notEnoughMoneyText, stageManager.textSpawnPosition); } } else { uCannotSpawnItYetText.transform.GetChild(0).GetComponent <Text>().text = startSpawnStage + "스테이지 이후부터 소환할 수 있습니다."; Instantiate(uCannotSpawnItYetText, stageManager.textSpawnPosition); } }
public void FusionCheck() { if (Input.GetMouseButtonUp(0)) { firstPositionSet = false; onlyOneFollowUnitNum = false; followingMouse = false; } if (Input.GetMouseButtonUp(0) && mouseCheck) { bool unitNumCheck = (fusionManager.GetFollowingUnitNum() == 0); onlyOneFollowUnitNum = false; if (!unitNumCheck) { fusionManager.SetFollowingUnitNum(0); followingCheck = false; } if (shortestScript != null) { if (shortestScript.unitId == unitId) { if (shortestDistance < firstUnitClickableRange && gameManager.GetMoney() >= levelUpCost) { if (!shortestScript.isDead) { LevelUp(shortestScript.unitId, unitLev, shortestScript.unitLev); } } else if (gameManager.GetMoney() < levelUpCost) { Instantiate(stageManager.notEnoughMoneyText, stageManager.textSpawnPosition); } else if (unitLev >= gameManager.GetSaveData().maxFusionLev) { Instantiate(stageManager.maxLevelText, stageManager.textSpawnPosition); } } } ComeBack(); mouseCheck = false; } else if (shortestScript != null) { if (followingMouse && shortestDistance < firstUnitClickableRange && unitId == shortestScript.GetUnitID() && unitLev == shortestScript.GetUnitLev()) { if (unitLev >= gameManager.GetSaveData().maxFusionLev) { costText.text = "이미 최대레벨입니다."; return; } costText.text = $"{levelUpCost} 원"; } else { costText.text = ""; } } else { costText.text = ""; } }