// Use this for initialization void Start() { Material loadedMaterial = null; if (GameObject.Find("Ball")) { loadedMaterial = GameObject.Find("Ball").GetComponent<Renderer>().sharedMaterial; Destroy(GameObject.Find("Ball")); } TextureSwapBall[] textureBalls = GameObject.FindObjectsOfType<TextureSwapBall>(); if (loadedMaterial) { foreach (TextureSwapBall thisBall in textureBalls) { if (thisBall.ballMaterial == loadedMaterial) { currentBall = thisBall; } } } else { currentBall = GameObject.FindObjectOfType<TextureSwapBall>(); } menuLoad = GameObject.Find("Scripts").GetComponent<LoadScenes>(); textureData = GameObject.Find("TextureSwapData").GetComponent<TextureSwapData>(); mainCamera.transform.position = new Vector3(currentBall.transform.position.x, currentBall.transform.position.y, mainCamera.transform.position.z); currentX = currentBall.transform.position.x; moveSpeed = .5f; timer = 0; moveCamera = false; }
public static LoadScenes LoadScene(string name, Action <float> fun, UnityEngine.SceneManagement.LoadSceneMode _mode = UnityEngine.SceneManagement.LoadSceneMode.Additive) { LoadScenes ls = LoadScenes.Get(); ls.Load(name, fun, _mode); return(ls); }
private void SetTier() { int level = PlayerPrefs.GetInt("level"); if (level == 0) { tier.sprite = tier0; } else if (level == 1) { tier.sprite = tier1; } else if (level == 2) { tier.sprite = tier2; } else if (level == 3) { tier.sprite = tier3; } else { LoadScenes.loadGameWonScene(); } }
IEnumerator WaitForWin() { yield return(new WaitForSeconds(3f)); if (CurrentFolder == "GameLevels") { string[] nameParse = CurrentMap.Split('-'); int num = int.Parse(nameParse[1]); int world = int.Parse(nameParse[0]); Save(num, world); LoadScenes.Instance.LoadLevelSelection(); } else { LoadScenes a = LoadScenes.Instance; if (a.TestingLevel) { a.LoadEditor(); a.setLevelTested(true); } else { a.LoadMenu(); } } }
void Update() { if (Input.GetKey(KeyCode.Escape)) { LoadScenes loadScenes = new LoadScenes(); loadScenes.OpenMain(); } }
public void OnClickGoTest() { LoadScenes a = LoadScenes.Instance; a.SetFolder("PlayerLevelsEditor"); a.SetupLevelName(LevelName); a.TestingLevel = true; a.LoadLevel(); }
private void Update() { if (slider.value <= 0) { LoadScenes.loadGameOverScene(); } amount.text = slider.value + " / " + slider.maxValue; SetTier(); }
private void Awake() { SceneInstance = this; _runtimeData._timeLeft = 300; _runtimeData._totalDragonCoins = 0; specialLevels = new List <string>() { "World Map", "Title Screen", "Yoshi's Island Home", "Intro Level", "Game Over Screen" }; flag = false; }
public void Save(int scene) { LoadScenes ls = transform.GetComponent <LoadScenes>(); Transform transfShuttle = shuttle.GetComponent <Transform>(); /* Salvo soltanto la posizione X dello shuttle, in modo da tornare alla scena "Explore" * più o meno vicino al pianeta che ho "cliccato". * (E' un modo da aggirare la situazione senza complicare lo script) */ PlayerPrefs.SetFloat("shuttlePositionX", transfShuttle.position.x); ls.LoadScene(scene); }
public void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; DontDestroyOnLoad(this.transform); return; } }
public void ResetGame() { float masterVolume = PlayerPrefs.GetFloat("volume"); PlayerPrefs.DeleteAll(); PlayerPrefs.SetFloat("volume", masterVolume); List <string> emptyList = new List <string>(); SaveIO.saveData("Inventory", emptyList); SaveIO.saveData("Furnace", emptyList); LoadScenes.loadMainMenuScene(); }
IEnumerator LoadScene_(int scene) { CanvasGroup canvasGroup = canvas.GetComponent <CanvasGroup>(); while (canvasGroup.alpha > 0) { canvasGroup.alpha -= Time.deltaTime; yield return(null); //Debug.Log("Diminuindo o alpha: " + canvasGroup.alpha); } //yield return new WaitForSeconds(1f); LoadScenes ls = canvas.GetComponent <LoadScenes>(); ls.LoadScene(scene); }
// Start is called before the first frame update IEnumerator Start() { load = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <LoadScenes>(); scoreText.SetText("<sup> <#50aaff>Durée " + score + "</color></sup>"); if (!gagner) { BravoText.text = "<size=100%>V</size >ous <size=100%>A</size>vez <size=100%>E</size>choué !"; } yield return(new WaitForSeconds(10.0f)); load.PlayGame(2); }
public override void Init() { base.Init(); this.Create(Config.VIEW_LOADFIGHT); float temp = (view.root.height - view.height) / 2; float temp2 = (view.root.width - view.width) / 2; view.width = view.root.width; view.height = view.root.height; int num = Tools.GetRandom(0, 4); bg = this.GetChild("n0").asLoader; bg.url = Tools.GetResourceUrl("Load:qidongye" + num.ToString()); bg.height = view.height; //ViewManager.bgOffsetW = bg.width * (bg.height / 640); //ViewManager.bgOffsetX = -(ViewManager.bgOffsetW - view.width) / 2; bg.width = ViewManager.bgOffsetW; bg.x -= temp2; bg.y = -temp; bar = this.GetChild("n4").asProgress; bar.x -= temp2; bar.GetChild("title").y += 4; bar.value = 20; ls = ViewManager.LoadScene("snake", (float f) => { Log.debug("LoadScene - " + f.ToString()); float ff = f * 100; if (ff <= 20) { ff = 20; } if (ff >= 90) { ff = 90; } bar.value = ff; if (bar.value >= 90) { ls.Clear(); } }); }
public void LoadMenu() { LoadScenes LoadScenes = LoadScenes.Instance; if (LoadScenes.folder == "GameLevels" && SceneManager.GetActiveScene().name == "Level") { LoadScenes.LoadLevelSelection(); } else if (LoadScenes.TestingLevel) { LoadScenes.setLevelTested(false); LoadScenes.LoadEditor(); } else { LoadScenes.LoadMenu(); } }
// Start is called before the first frame update IEnumerator Start() { load = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <LoadScenes>(); WWW users = new WWW("http://chachaser.000webhostapp.com/ReadUser.php"); yield return(users); giantString = users.text; Debug.Log(giantString); registeredUsers = giantString.Split(';'); string pattern = @"Username = (.*)\|Password = (.*)"; for (int i = 0; i < registeredUsers.Length; i++) { Match m = Regex.Match(registeredUsers[i], pattern); usernames.Add(m.Groups[1].Value); passwords.Add(m.Groups[2].Value); } }
public void loadMenuScene() { LoadScenes.loadMenuScene(); }
// Start is called before the first frame update public void Start() { load = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <LoadScenes>(); if (!velo) { player = GameObject.FindGameObjectWithTag("Player"); me = player.GetComponent <NavMeshAgent>(); } username = UserConnection.username; if (velo) { table = "Velo"; } else { table = "Cardio"; } /*recuperer toutes les parties du user * WWWForm form = new WWWForm(); * form.AddField("usernamePost", username); * form.AddField("tablePost", table); * * WWW users = new WWW("http://chachaser.000webhostapp.com/ReadAllCardio.php", form); * yield return users; */ giantString = ""; // = users.text if (giantString == "") // la premeiere partie du user { niv1 = true; timerText.text = "Timer 01 :00"; mainTimer = 60; } else { registeredUsers = giantString.Split(';'); string pattern = @"score = (.*)\|cpt = (.*)"; for (int j = 0; j < registeredUsers.Length; j++) { Match m = Regex.Match(registeredUsers[j], pattern); scores.Add(m.Groups[1].Value); cpts.Add(m.Groups[2].Value); } //le nbr de parties jouées total = int.Parse(cpts[registeredUsers.Length - 2]); if (total < 5) { niv1 = true; switch (total) { case 1: //partie 2 timerText.text = "Timer 02:00"; mainTimer = 120; break; case 2: //partie 3 timerText.text = "Timer 03:30"; mainTimer = 210; break; case 3: //partie 4 timerText.text = "Timer 03:00"; mainTimer = 180; break; case 4: //partie 5 timerText.text = "Timer 04:00"; mainTimer = 240; break; } } else { // total ==> max cpt /*s'il n'a tjr pas gagné la derniere partie , il doit la rejouer * WWWForm form2 = new WWWForm(); * form2.AddField("usernamePost", username); * form2.AddField("cptPost", total.ToString()); * form2.AddField("tablePost", table); * * WWW win = new WWW("http://chachaser.000webhostapp.com/RecupScore.php", form2); * yield return win; */ giantString = "F"; // = win.text if (giantString == "F") { //il rejoue la partie rej = true; int scoreDPNP = int.Parse(scores[registeredUsers.Length - 2]); scorePredit = scoreDPNP; niv1 = false; } else { //predir le score de la partie niv1 = false; // ********************************premiere partie d'un niveau************************************************* if (total % 5 == 0) { int scoreDPNP = int.Parse(scores[registeredUsers.Length - 2]); //score de la derniere partie du niveau precedent scorePredit = scoreDPNP + 10; } else { int i = 1; while (i <= total) { int j = i; Dictionary <string, int> p_s = new Dictionary <string, int>(); while (i <= total && (i % 5 > 0)) { p_s.Add("partie " + (i % 5), int.Parse(scores[i - 1])); i++; } if (i < total + 1 && i % 5 == 0) { p_s.Add("partie 5", int.Parse(scores[i - 1])); } data1.Add("Niveau " + (j / 5 + 1), p_s); i++; } var nbr = (total / 5) + 1; string qq = "Niveau " + nbr; Dictionary <string, float> resu = recommend(qq, 5); int nbr_p = 5 - resu.Count + 1; string pp = "partie " + nbr_p; scorePredit = (int)resu[pp]; } niv1 = false; } mainTimer = (scorePredit * 30) / 5; } } print(scorePredit);//****************************************verif************************************* timer = mainTimer; FirstTiming = mainTimer; calculateTimer(); player.GetComponent <Teleportation>().enabled = true; }
private void Awake() { Instance = this; }
// Use this for initialization void Start() { menuLoad = GameObject.Find("Scripts").GetComponent<LoadScenes>(); ball = GameObject.Find("Ball").GetComponent<Ball>(); //Overlay setup sprite = GameObject.Find("Overlay").GetComponent<Image>(); startAlpha = sprite.color.a; alpha = gameObject.AddComponent<AlphaTransition>(); //MenuUIButton setup buttonTap = gameObject.GetComponent<AudioSource>(); //GameOverUI setup continueButton = GameObject.Find("Continue").GetComponent<Button>(); continuesLeftText = GameObject.Find("ContinuesLeft").GetComponent<Text>(); lastRunText = GameObject.Find("GameOverScoreText").GetComponent<Text>(); highScoreText = GameObject.Find("HighScoreText").GetComponent<Text>(); continuesLeft = 2; startUICanvas.enabled = true; inGameOverUI = false; }
private void death() { // Instantiate(deathAudio, transform.position,Quaternion.identity); // Destroy(gameObject,1f); LoadScenes.loadGameOverScene(); }
public void loadVisualizationScene() { LoadScenes.loadMainScene(); }
void Start() { MoveBoundaries(); scene = FindObjectOfType <LoadScenes>(); }
public void loadResultScene() { LoadScenes.loadResultScene(); }