void SlimeParty2() { if (SP2Started == false && gm.isInterRound == false) { UserChat.CreateChat("아니 이게 무슨..!", 2); UserChat.CreateChat("메이플 하고싶다", 3); UserChat.CreateChat(UserChat.BadChat("내 다람쥐 어디갔어!!"), 2); SP2Started = true; } if (gm.timeLeft <= 1) { // 다람쥐와 슬라임을 스왑함 GameObject temp = GameObject.Find("AddBasicDaram").GetComponent <AddBasicDaram>().daram; GameObject.Find("AddBasicDaram").GetComponent <AddBasicDaram>().daram = SlimeParty_Slime; SlimeParty_Slime = temp; SlimeParty_Slime.GetComponent <Daram>().Type = "Slime"; gm.EventCheck -= SlimeParty2; Instantiate(SlimeParty_Box2); Unlockables.SetBool("UnlockSlime1", true); Unlockables.SetBool("UnlockSlime1_Amount10", true); Unlockables.SetBool("UnlockMush2", true); Unlockables.SetBool("UnlockMush2_Amount10", true); } }
void QuantityControlStart() { GameObject up = transform.GetChild(1).GetChild(0).gameObject; GameObject down = transform.GetChild(1).GetChild(1).gameObject; switch (DaramAmount) { case 1: n_up = 10; n_down = 0; break; case 10: n_up = 100; n_down = 1; break; case 100: n_up = 0; n_down = 10; break; } if (n_up != 0 && Unlockables.GetBool("Unlock" + Daram.Type + Daram.Level + "_Amount" + n_up) == true) { up.SetActive(true); up.GetComponentInChildren <Text>().text = n_up.ToString(); } if (n_down != 0 && Unlockables.GetBool("Unlock" + Daram.Type + Daram.Level + "_Amount" + n_down) == true) { down.SetActive(true); down.GetComponentInChildren <Text>().text = n_down.ToString(); } QuantityControlOn = true; }
void Update() { if (Unlockables.GetBool(UnlockKey) == false) { transform.localScale = Vector3.zero; } else { transform.localScale = new Vector3(1, 1, 1); } Vector3 v = rect.localScale; v.y = DaramFunc.solution / MaxDiff; rect.localScale = v; if (DaramFunc.diff >= 0) // 다람쥐 수가 적정 수준 이상이면 화살표가 아래를 향함 { slider.value = DaramFunc.solution / MaxDiff + 0.1f * Mathf.Sin(3.0f * GameManager.gm.time); arrowrect.localScale = new Vector3(1, -1, 1); } else // 다람쥐 수가 적정 수준보다 적으면 화살표가 위를 향함 { slider.value = (-1) * DaramFunc.solution / MaxDiff - 0.1f * Mathf.Sin(3.0f * GameManager.gm.time); arrowrect.localScale = new Vector3(1, 1, 1); } }
void CommonSettings() // 스테이지 공통 설정 { gm = GameManager.gm; Unlockables.SetBool("UnlockBasic1", true); Unlockables.SetBool("UnlockBasic1_Amount1", true); Unlockables.SetBool("UnlockBasic2_Amount1", true); Unlockables.SetBool("UnlockRainbow1_Amount1", true); Unlockables.SetBool("UnlockRainbow2_Amount1", true); Unlockables.SetBool("UnlockSlime1_Amount1", true); Unlockables.SetBool("UnlockMush2_Amount1", true); Unlockables.SetInt("Basic1Health", 100); Unlockables.SetInt("Basic2Health", 500); Unlockables.SetInt("Rainbow1Health", 300); Unlockables.SetInt("Rainbow2Health", 1000); Unlockables.SetInt("Slime1Health", 700); Unlockables.SetInt("Mush2Health", 2000); Unlockables.SetInt("Tokki1Health", 1000); Unlockables.SetInt("Tokki2Health", 3500); gm.bugResponeTimeMin = 8.0f; gm.bugResponeTimeMax = 12.0f; gm.roundCount = 0; }
IEnumerator MasterContract(Item item) { if (Unlockables.GetBool("UnlockBasic2") == true) { float startTime = GameManager.gm.time; int numChangeOfUser = Mathf.Min(GameManager.gm.userCount[User.level1], 1000); GameManager.gm.userCount[User.level2] += numChangeOfUser; while (true) { yield return(new WaitForSeconds(0.1f)); if (GameManager.gm.time - startTime > item.itemDuration) { GameManager.gm.userCount[User.level2] -= Mathf.Min(numChangeOfUser, GameManager.gm.userCount[User.level2]); GameManager.gm.userCount[User.level1] += numChangeOfUser; break; } } } else { GameManager.gm.ShowMessageBox("중급 유저가 개방되지 않았으므로 효과가 없었다!"); yield return(new WaitForSeconds(0f)); } isItemUsing[item.itemID] = false; }
IEnumerator ExpEvent() { float userUpdateTime = Time.time; while (true) { if (GameManager.gm.isRoundEventOn == false) { StopCoroutine(ExpEvent()); } gm.FameDaram1(); if (Unlockables.GetBool("UnlockDaram1") == true) { gm.FameDaram2(); if (GiveDelay(1.0f, ref userUpdateTime)) { gm.UserLevel2(); } } yield return(StartCoroutine(WaitFor.Frames(3))); // 3프레임 당 한번 = 33.3% } }
IEnumerator Holiday() { float userUpdateTime = Time.time; while (true) { if (gm.isRoundEventOn == false) { StopCoroutine(Holiday()); } if (GiveDelay(1.0f, ref userUpdateTime)) { gm.UserLevel1(); } gm.FameDaram1(); if (Unlockables.GetBool("UnlockDaram1") == true) { gm.FameDaram2(); } yield return(StartCoroutine(WaitFor.Frames(1))); // 1프레임 당 한번 = 100% } }
IEnumerator ET() { yield return(new WaitForSeconds(0.5f)); Unlockables.SetBool("Emergency", true); Instantiate(EmergencyTutorial_Box); }
// 새로고침 할 수 있게 변경함 public void RefreshTooltip() { foreach (GameObject go in upgradeList) { Upgrade Upgrade = database.Find(go.name); if (Upgrade != null) { string tooltip = "<color=#ffffff>" + Upgrade.upgradeName + "</color>\n\n"; if (Upgrade.upgradeName == "서버 증설") // 이걸 만들기가 너무 힘들어서 예외처리함 { tooltip += "<color=#000000>" + "서버 한 대당 " + Unlockables.GetInt("ServerEff") + "명의 유저를 추가로 수용합니다." + "</color>\n\n"; } else { tooltip += "<color=#000000>" + Upgrade.upgradeDescription + "</color>\n\n"; } tooltip += "<color=#990282>" + "가격 : " + Upgrade.upgradePrice + "</color>\t\t"; //tooltip += "<color=#990282>" + "필요 개발자 수 : " + Upgrade.upgradeRequiredDev + "</color>\t\t"; if (Upgrade.upgradeQuantity != 0) { tooltip += "<color=#990282>" + Upgrade.upgradeQuantityName + " : " + Unlockables.GetInt(Upgrade.upgradeTooltipName) + "</color>"; } go.GetComponentInChildren <Text>().text = tooltip; } } upgradeStatusText.text = "남은 돈 : " + GameManager.gm.Money(); }
//itemDatabase와는 달리 다른 script(e.g. inventory)가 없어 이곳에 함수를 넣음 나중에 다른 적절한 script가 생기면 옮기자. public void AddUpgrade(Upgrade upgrade) { if (gm.Money() < upgrade.upgradePrice) { GameManager.gm.ShowMessageBox("돈이 부족합니다."); return; } else { gm.ChangeMoneyInterRound(-upgrade.upgradePrice); if (upgrade.upgradeQuantity == 0) { Unlockables.SetBool(upgrade.upgradeInternalName, !Unlockables.GetBool(upgrade.upgradeInternalName)); // bool 값을 반전시킴 upName = upgrade.upgradeName; GameManager.gm.appliedUpgrades = GameManager.gm.appliedUpgrades + upName + "\n"; State.state.refreshUpgrade(); int tempID = upgrade.upgradeID; upgradeDatabase.Remove(upgrade); //upgradeDatabase.Remove(upgrade); reSorting(tempID); UpgradeCheckup.upgradeChkup.MakeUpgradeList(); } else { Unlockables.SetInt(upgrade.upgradeInternalName, Unlockables.GetInt(upgrade.upgradeInternalName) + upgrade.upgradeQuantity); } upgrade.upgradePrice = (int)(upgrade.upgradePrice + upgrade.upgradeModifier); } }
public void Stage1Start() { CommonSettings(); gm = GameManager.gm; Unlockables.SetInt("Server", 1); Unlockables.SetInt("ServerEff", 5000); Unlockables.SetBool("RivalGameOn", false); }
void DaramUpDownTutorial() { if (Unlockables.GetBool("UnlockDaram1_Amount10") || Unlockables.GetBool("UnlockDaram2_Amount10")) { Instantiate(DaramUpDownTutorial_Box); gm.RoundStartEvent -= DaramUpDownTutorial; } }
//update whether the player has unlocked something or not public void UpdateUnlocks(Unlockables key, bool value) { //Debug.Log(unlockables.Count + "count"); //Debug.Log(key.ToString() + "String"); if (currentSave.unlockables.ContainsKey(key.ToString())) { currentSave.unlockables[key.ToString()] = value; } }
// 각 스테이지의 초기조건을 지정해주는 스크립트 // 기존에 흩어져 있던 것들을 여기로 옮길 예정 void Start() { Unlockables.SetBool("UnlockDaram1", true); Unlockables.SetBool("UnlockDaram1_Amount1", true); Unlockables.SetBool("UnlockDaram2_Amount1", true); Unlockables.SetInt("Server", 1); Unlockables.SetInt("ServerEff", 5000); }
void IsSkinUnlockedOnLoad(Unlockables skins) { if (GameSave.currentSave.GetUnlocks(skins)) { gameObject.GetComponent <Button>().interactable = true; } else { gameObject.GetComponent <Button>().interactable = false; } }
void Start() { slider = GetComponent <Slider>(); maxValue = (int)slider.maxValue; fameValue = GameObject.Find("EnemyFameText").GetComponent <Text>(); if (Unlockables.GetBool("RivalGameOn") == false) { this.gameObject.SetActive(false); } }
//check whether the player has unlocked something or not public bool GetUnlocks(Unlockables key) { //Debug.Log(key.ToString() + "String"); //Debug.Log(currentSave.lastCompletedLevel + "last completede"); if (currentSave.unlockables.ContainsKey(key.ToString())) { return(currentSave.unlockables[key.ToString()]); } return(false); }
void Update() { if (Unlockables.GetBool("Emergency") == true) { transform.localScale = new Vector3(0.5f, 0.5f, 1.0f); } else { transform.localScale = Vector3.zero; } }
void Update() { // 해금되었는지 확인 string key = "UnlockDaram" + daram.GetComponent <Daram>().Level; button.interactable = Unlockables.GetBool(key); DaramAmountText.text = DaramAmount.ToString(); if (GameManager.gm.isPaused || !button.interactable) { return; } if (Input.GetMouseButtonDown(0)) { LatestClick = gm.time; } else if (Input.GetMouseButton(0) && pointerOn && !QuantityControlOn && gm.time - LatestClick > 0.15f) { QuantityControlStart(); } if (Input.GetMouseButtonUp(0) && QuantityControlOn) { QuantityControlEnd(); } if (Input.GetMouseButtonDown(1) && pointerOn) { //Debug.Log("RightClicked"); daramInfo.SetActive(true); } if (Input.GetMouseButtonUp(1)) { daramInfo.SetActive(false); } // 개발자 한명당 3초에 한마리씩 뿌림 if (GameManager.gm.isInterRound == false && daram.GetComponent <Daram>().Level == 1 && Developer.dev.developerCount[Developer.dev.FindPostIDByName("DaramLv1")] != 0 && gm.time >= DeveloperTime) { Create(1); // 개발자가 뿌리는 다람쥐는 돈이 들지 않음 (대신 개발자에게 따로 월급을 줌) DeveloperTime = gm.time + Developer.dev.developerMonsterGenerationTime / Developer.dev.developerCount[Developer.dev.FindPostIDByName("DaramLv1")]; } if (GameManager.gm.isInterRound == false && daram.GetComponent <Daram>().Level == 2 && Developer.dev.developerCount[Developer.dev.FindPostIDByName("DaramLv2")] != 0 && gm.time >= DeveloperTime) { Create(1); // 개발자가 뿌리는 다람쥐는 돈이 들지 않음 (대신 개발자에게 따로 월급을 줌) DeveloperTime = gm.time + Developer.dev.developerMonsterGenerationTime / Developer.dev.developerCount[Developer.dev.FindPostIDByName("DaramLv2")]; } }
// 매 라운드 시작시마다 호출됨 void CheckDaramDeveloper() { if (roundCount == 1) // 시작할때 developerCount 초기화가 안되어 있어서 예외처리함 { return; } Unlockables.SetBool("UnlockDaram1_Amount10", dev.developerCount[dev.FindPostIDByName("DaramLv1")] >= 3); Unlockables.SetBool("UnlockDaram1_Amount100", dev.developerCount[dev.FindPostIDByName("DaramLv1")] >= 9); Unlockables.SetBool("UnlockDaram2_Amount10", dev.developerCount[dev.FindPostIDByName("DaramLv2")] >= 3); Unlockables.SetBool("UnlockDaram2_Amount100", dev.developerCount[dev.FindPostIDByName("DaramLv2")] >= 9); }
public void deserialize(byte[] aData) { //Debug.Log((new UnicodeEncoding()).GetString(aData)); mUnlocked = JsonConvert.DeserializeObject <Unlockables>((new UnicodeEncoding()).GetString(aData)); /* old C# serialization/deserialization, wont work on XB1 due to JIT issue * try{ * IFormatter formatter = new BinaryFormatter(); * MemoryStream stream = new MemoryStream(aData); * mUnlocked = (Unlockables) formatter.Deserialize(stream); * stream.Close(); * } catch {} */ }
void VarietyTutorial() { if (gm.UserAllCount() >= 10000 && gm.roundCount != ETRound) { Unlockables.SetBool("UnlockRainbow1", true); Unlockables.SetBool("UnlockRainbow2", true); UpgradeDatabase ud = GameObject.Find("Database").GetComponent <UpgradeDatabase>(); ud.upgradeDatabase.Add(new Upgrade("LV.1 무지개 다람쥐 많이 뿌리기", 5, 3000, 1, "Rainbow Lv.1 다람쥐를 한번에 10마리씩 뿌릴 수 있는 능력이 추가됩니다.", "UnlockRainbow1_Amount10")); ud.upgradeDatabase.Add(new Upgrade("LV.2 무지개 다람쥐 많이 뿌리기", 6, 5000, 1, "Rainbow Lv.2 다람쥐를 한번에 10마리씩 뿌릴 수 있는 능력이 추가됩니다.", "UnlockRainbow2_Amount10")); Instantiate(VarietyTutorial_Box); gm.EventCheck -= VarietyTutorial; gm.EventCheck += Stage1Clear; } }
void UnlockTokki() { if (GameManager.gm.fame >= 25000) { GameManager.gm.EventCheck -= UnlockTokki; Instantiate(UnlockTokki_Box); LogText.WriteLog("초심으로 돌아가 토끼 다람쥐를 개발했다!"); Unlockables.SetBool("UnlockTokki1", true); Unlockables.SetBool("UnlockTokki1_Amount10", true); Unlockables.SetBool("UnlockTokki2", true); Unlockables.SetBool("UnlockTokki2_Amount10", true); } }
void Update() { if (Unlockables.GetBool("Emergency") == true) { transform.localScale = new Vector3(0.5f, 0.5f, 1.0f); if (Input.GetKeyDown(Hotkey)) { OnClick(); } } else { transform.localScale = Vector3.zero; } }
// Pseudo-singleton concept from Unity dev tutorial video. void Awake() { if (Instance == null) { DontDestroyOnLoad(gameObject); Instance = this; player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerState>(); unlockables = GameObject.FindGameObjectWithTag("Unlockables").GetComponent <Unlockables>(); } else if (Instance != this) { Destroy(gameObject); } }
void UnlockUpBasic() { if (GameManager.gm.fame >= 10000) { GameManager.gm.EventCheck -= UnlockUpBasic; Instantiate(UnlockUpBasic_Box); LogText.WriteLog("인기에 힘입어 LV.2 다람쥐를 개발했다!"); UserChat.CreateChat("GM: 고레벨 다람쥐가 새롭게 등장합니다!!", 5); gm.FameChange += gm.FameDaram2; gm.UserChange += gm.UserLevel2; gm.EventCheck += UserChat.uc.Daram2Number; Unlockables.SetBool("UnlockDaram2", true); } }
public static bool CheckTutorial() { if (Unlockables.GetInt("Server") <= 1 && GameManager.gm.isTutorialCleared[51] == true) { GameManager.gm.ShowMessageBox("서버를 구매해주세요"); return(true); } //버그 있다 잡자 if (GameManager.gm.isTutorialCleared[50] == true && (Unlockables.GetInt("Basic1Health") <= 100 && Unlockables.GetInt("Basic2Health") <= 500 && Unlockables.GetBool("UnlockBasic1_Amount10") == false && Unlockables.GetBool("UnlockBasic2_Amount10") == false)) { GameManager.gm.ShowMessageBox("다람쥐 업그레이드를 해주세요"); return(true); } return(false); }
private void Start() { _restartsRemaining = NumberOfRestarts; _internalWaveCounter = 0; _timeRemainingForNextWave = TimeBetweenWaves; _periodicCheck = PeriodicCheck; CurrentSpawnPoint = 0; _unlockables = GameObject.FindObjectOfType <Unlockables>(); _currentTurrets = FindObjectsOfType <Turret>(); GameObject[] _spawnPointsRaw = GameObject.FindGameObjectsWithTag("Spawn"); _spawnPoints = new List <Transform>(); foreach (GameObject spawnPoint in _spawnPointsRaw) { _spawnPoints.Add(spawnPoint.transform); } }
void UserLimitExcess() { if (GameManager.gm.UserAllCount() > Unlockables.GetInt("UserLimit") + 50) { Instantiate(UserLimitExcess_Box); LogText.WriteLog("서버가 게임의 인기를 감당하지 못하고 폭파되었습니다."); //유저채팅 추가 gm.UserChat += UserChat.uc.UserLimitExcess; GameManager.gm.userCount[User.level1] -= (int)(GameManager.gm.userCount[User.level1] * Random.Range(0.3f, 0.5f)); GameManager.gm.userCount[User.level2] -= (int)(GameManager.gm.userCount[User.level2] * Random.Range(0.3f, 0.5f)); GameManager.gm.fame -= (int)(GameManager.gm.fame * 0.2); } }
void MakeItemList() { SetRandomItemID(); if (Unlockables.GetBool("RivalGameOn")) { numOfShowingTotalItem = numOfShowingNormalItem + 1; } SetListSize(itemscrollPanelrect); List <GameObject> itemList = new List <GameObject>(); for (int i = 0; i < numOfShowingTotalItem; i++) { int randomID; Item item; if (i >= numOfShowingNormalItem) { randomID = Random.Range(0, database.rivalItemDatabase.Count); item = database.rivalItemDatabase[randomID]; } else { randomID = Random.Range(0, randomItemID.Count); item = database.itemDatabase[randomItemID[randomID]]; randomItemID.RemoveAt(randomID); } GameObject newItem = Instantiate(itemListTemplate, new Vector3(0f, (itemscrollPanelrect.rect.height / 2f) - 120f * (float)i - 20f, 0f), Quaternion.identity) as GameObject; newItem.name = item.itemName; /* 다른 children이 추가되면 아래 코드에서 에러가 발생할 수도? */ newItem.GetComponentInChildren <Image>().sprite = Sprite.Create(item.itemImage, new Rect(0, 0, imageIconSize, imageIconSize), new Vector2(0f, 0f)); newItem.transform.SetParent(itemScrollPanel.transform, false); newItem.GetComponentInChildren <Text>().text = inventory.CreateTooltip(item); newItem.GetComponentInChildren <ItemBuyButton>().SetItem(item); itemList.Add(newItem); } if (Unlockables.GetBool("RivalGameOn")) { int randomID = Random.Range(0, database.rivalItemDatabase.Count); Item item = database.rivalItemDatabase[randomID]; } }