private void Awake() { LostMenu.SetActive(false); WinningMenu.SetActive(false); CreateBallPlayerList(); ReadLevel(); Instance = this; PointsText.SetText(Points.ToString()); RecordText.SetText(PlayerPrefs.GetInt("Score").ToString()); }
// Start is called before the first frame update void Start() { Levels = new List <GameObject>(); LB = GameObject.Find("SaveData").GetComponent <LevelBuild>(); for (int i = 0; i < LevelsContent.transform.childCount; i++) { GameObject Level_B = LevelsContent.transform.GetChild(i).gameObject; LevelManager LM = Level_B.GetComponent <LevelManager>(); Points += LM.StarsCount; Levels.Insert(i, Level_B); } // When find Level block - Set true bool FirstLevelBlock = false; // Unlocks levels and set "Next Points" bool SetNextStar = false; for (int i = 0; i <= LevelGroupe; i++) { for (int q = (i * LevelsEtap); q <= (i * LevelsEtap) + (LevelsEtap - 1); q++) { if (Levels.Count > q) { if (Points >= (i * (LevelsEtap * 2))) { Levels[q].SetActive(true); } else { if (!SetNextStar) { SetNextStar = true; NeedStars_T.text = (i * (LevelsEtap * 2)).ToString(); } if (!FirstLevelBlock) { FirstLevelBlock = true; LB.LevelBlock = q; } Levels[q].SetActive(false); } } else { break; } } } AllStars_T.text = Points.ToString(); }
private void Awake() { //LevelMenu(Clone) //SecondLevelMenu(Clone) if (transform.parent.parent.parent.parent.name == "LevelMenu(Clone)" || transform.parent.parent.parent.parent.name == "LevelMenu") { LevelMode = 0; } else if (transform.parent.parent.parent.parent.name == "SecondLevelMenu(Clone)" || transform.parent.parent.parent.parent.name == "SecondLevelMenu") { LevelMode = 1; } ////Reset //PlayerPrefs.SetFloat("UnlockCircle", 0); //PlayerPrefs.SetFloat("SelfTime" + gameObject.name.Substring(6) + LevelMode, 0); //PlayerPrefs.SetString("Wins" + gameObject.name.Substring(6) + LevelMode, ""); //PlayerPrefs.SetFloat("T" + gameObject.name.Substring(6) + LevelMode, 0); ////End Reset LB = GameObject.Find("SaveData").GetComponent <LevelBuild>(); levelWin = PlayerPrefs.GetString("Wins" + gameObject.name.Substring(6) + LevelMode) == "True" ? true : false; PlayerTime = PlayerPrefs.GetFloat("T" + gameObject.name.Substring(6) + LevelMode); try { string[] words = PlayerTime.ToString().Split(new char[] { '.' }); float second = Mathf.Round(Convert.ToSingle(words[1])); } catch { } // Star On Level int count = 0; foreach (float time in TimeBonuses) { if (levelWin && (float)PlayerTime >= (float)time) { Stars[count].SetActive(true); count++; } } StarsCount = count; StarSumm += StarsCount; }
// Start is called before the first frame update void Awake() { LB = GameObject.Find("SaveData").GetComponent <LevelBuild>(); LevelMode = LB.LevelMode; LevelCircles = new List <GameObject>(LB.CS_Level.Count); int PositionSpawn = 0; int count = 0; foreach (CirclesSpawn Circle in LB.CS_Level) { if (PositionSpawn < SizeCircles.Count) { GameObject CircleObj = Instantiate(Circle.CircleType, transform.position, transform.rotation); LevelCircles.Add(CircleObj); CircleObj.GetComponent <MainCircle>().SetCircleSize(SizeCircles[PositionSpawn]); CircleObj.GetComponent <MainCircle>().SetID(PositionSpawn); if (LB.CirclesRotationPosZ.Count > 0) { CircleObj.transform.rotation = Quaternion.Euler(0, 0, LB.CirclesRotationPosZ[count]); } if (LevelMode == 1) { CircleObj.transform.localScale *= 1 + (float)PositionSpawn / 10; } PositionSpawn++; } else { break; } count++; } CircleName.text = LB.CS_Level[0].CircleType.GetComponent <MainCircle>().GetName(); float ResolX = Screen.height * (ProcentXScreenSize / 100); float ResolY = Screen.width * (ProcentYScreenSize / 100); vec = new Vector3(ResolY, ResolX); }
private void Start() { LB = GameObject.Find("SaveData").GetComponent <LevelBuild>(); Level = LB.LevelButtonID; sec = LB.StartTimeLevel == 0 ? 6 : LB.StartTimeLevel; // if 0 - Set default time "6" if (LB.LevelMode == 1) { LR = gameObject.GetComponent <LineRenderer>(); LR.SetPosition(0, transform.position); vec = LB.PlayerVecorMove.normalized; LR.SetPosition(1, vec); } try { if (LB.RecordTime == 0) { minuteRec = 0; secondRec = 0; } else { string[] words = LB.RecordTime.ToString().Split(new char[] { '.' }); minuteRec = Convert.ToSingle(words[0]); secondRec = Mathf.Round(Convert.ToSingle(words[1])); } string m = minuteRec < 10 ? "0" + minuteRec.ToString() : minuteRec.ToString(); string s = secondRec < 10 ? "0" + secondRec.ToString() : secondRec.ToString(); RecordTime.text = m + " : " + s; for (int i = 0; i < LB.Stars; i++) { Stars[i].SetActive(true); } } catch { } }
private void Start() { LB = GameObject.Find("SaveData").GetComponent <LevelBuild>(); Time.timeScale = 1; }