public void SpeciesRescued() { for (int i = 0; i < m_SkillBt.Length; i++) { if (m_SkillBt[i] != null) { m_SkillBt[i].AddAmount(m_Amount[i]); } } UserData.RescueSpecies(m_SpeciesID); int count = UserData.m_EnabledSpecies[m_SpeciesID]; if (count == 1) { m_ConfirmPanel.m_Title.text = "救援成功"; m_ConfirmPanel.m_Image.sprite = GetComponent <SpriteRenderer>().sprite; m_ConfirmPanel.m_Info.text = m_SpeciesName; m_ConfirmPanel.OpenMenu(); } else if (count % 10 == 0) { m_ConfirmPanel.m_Title.text = "救援 " + count + " 次"; m_ConfirmPanel.m_Image.sprite = GetComponent <SpriteRenderer>().sprite; m_ConfirmPanel.m_Info.text = m_SpeciesName; m_ConfirmPanel.OpenMenu(); //消除跟目前物種同色的方塊 GameObject gc = GameObject.FindGameObjectWithTag("GameController"); GameObject box = gameObject.transform.parent.gameObject; BoxElementControl bec = box.GetComponent <BoxElementControl>(); Debug.Log(bec.m_Type); gc.GetComponent <BoxGenerator>().EliminateBoxWithType(bec.m_Type); } }
public void CheckLevelUnlock() { string sceneName = SceneManager.GetActiveScene().name; switch (UserData.m_LevelUnlock) { case 0: //農業時代 if (sceneName == "AgeAgriculture") { if (m_InfoBar.m_MaterialNum >= 300) { UserData.m_LevelUnlock++; UserData.SaveUserData(); m_ConfirmPanel.m_Title.text = "關卡解鎖"; m_ConfirmPanel.m_Image.sprite = m_LevelSprite[UserData.m_LevelUnlock]; m_ConfirmPanel.m_Info.text = "工業時代"; m_ConfirmPanel.OpenMenu(); } } break; case 1: //工業時代 if (sceneName == "AgeFactory") { if (m_InfoBar.m_DNANum >= 100) { UserData.m_LevelUnlock++; UserData.SaveUserData(); m_ConfirmPanel.m_Title.text = "關卡解鎖"; m_ConfirmPanel.m_Image.sprite = m_LevelSprite[UserData.m_LevelUnlock]; m_ConfirmPanel.m_Info.text = "資訊時代"; m_ConfirmPanel.OpenMenu(); } } break; case 2: //資訊時代 if (sceneName == "AgeNetwork") { if (m_InfoBar.m_MaterialNum >= 2000 && m_InfoBar.m_DNANum >= 200) { UserData.m_LevelUnlock++; UserData.SaveUserData(); m_ConfirmPanel.m_Title.text = "關卡解鎖"; m_ConfirmPanel.m_Image.sprite = m_LevelSprite[UserData.m_LevelUnlock]; m_ConfirmPanel.m_Info.text = "核戰時代"; m_ConfirmPanel.OpenMenu(); } } break; case 3: //核戰時代 bool allRescue = true; for (int i = 0; i < 45; i++) { if (UserData.m_EnabledSpecies[i] == 0) { allRescue = false; break; } } if (allRescue) { UserData.m_LevelUnlock++; m_ConfirmPanel.m_Title.text = "關卡解鎖"; m_ConfirmPanel.m_Image.sprite = m_LevelSprite[UserData.m_LevelUnlock]; m_ConfirmPanel.m_Info.text = "寶島時代"; m_ConfirmPanel.OpenMenu(); UserData.SaveUserData(); } break; } }