void Update() { if (finished == false && PlayerScoreUGUI.playerDistance() > changeDistance) { if (runtimeLevel == BaseLevels[BaseLevel].LevelSequence.Count - 1) { finished = true; } else { runtimeLevel++; LevelMakerScript.SetLevel(BaseLevels[BaseLevel].LevelSequence[runtimeLevel].LevelId); changeDistance = BaseLevels[BaseLevel].LevelSequence[runtimeLevel].nextChangeDistance; } } }
void Update() { //Add basic conditions here. if (PlayerScoreUGUI.playerDistance() > 500f) { achivementscript.CompleteAnAchivement(0); //Calling the complete achivement function of Achivements script } if (PlayerScoreUGUI.playerDistance() > 3000f) { achivementscript.CompleteAnAchivement(1); } if (playerScore.playerCoin() > 200f) { achivementscript.CompleteAnAchivement(2); } if (playerScore.playerCoin() > 1000f) { achivementscript.CompleteAnAchivement(3); } }
/// <summary> /// /// </summary> void Update() { for (int i = 0; i < Worlds.Count; i++) { if (Worlds[i].minAppearLimit > 0f && Worlds[i].maxAppearLimit != -1f) { if (Worlds[i].minAppearLimit > Worlds[i].maxAppearLimit) { Debug.LogError("Appears after distance has greater value than Doesn't appear after distance which is not allowed."); break; } } if (Worlds[i].minAppearLimit > 0) { if (PlayerScoreUGUI.playerDistance() < Worlds[i].minAppearLimit) { Worlds[i].probability = 0f; } else { Worlds[i].probability = Worlds[i].cacheProbability; } } if (Worlds[i].maxAppearLimit != -1f && PlayerScoreUGUI.playerDistance() > Worlds[i].minAppearLimit) { if (PlayerScoreUGUI.playerDistance() > Worlds[i].maxAppearLimit) { Worlds[i].probability = 0f; } else { Worlds[i].probability = Worlds[i].cacheProbability; } } } //Here goes the floating point fix Logic we move the Player along with the world to origin in such a way that no extra relative motion is noticiable transform.position = player.transform.position; if (Mathf.Abs(transform.position.x) > 9000f || Mathf.Abs(transform.position.y) > 9000f || Mathf.Abs(transform.position.z) > 9000f) //A value above which move back to origin { player.transform.parent = this.transform; for (int i = 0; i < Worlds.Count; ++i) { for (int j = 0; j < Worlds[i].tracks.Count; ++j) { for (int k = 0; k < Worlds[i].tracks[j].pools.Count; ++k) { if (Worlds[i].tracks[j].pools[k].activeInHierarchy == true) { Worlds[i].tracks[j].pools[k].transform.parent = this.transform; //Parenting all active tracks to this transform } } } } transform.position = Vector3.zero; //Moving to origin player.transform.parent = null; for (int i = 0; i < Worlds.Count; ++i) { for (int j = 0; j < Worlds[i].tracks.Count; ++j) { for (int k = 0; k < Worlds[i].tracks[j].pools.Count; ++k) { if (Worlds[i].tracks[j].pools[k].activeInHierarchy == true) { Worlds[i].tracks[j].pools[k].transform.parent = null; //Reseting all finally } } } } } }