public void refreshRecords() { records.Clear(); for (int i = 0; i < 5; i++) { records.Add(PlayerPrefs.GetFloat(level.ToString() + i.ToString(), 0)); } timer time = GameObject.Find("Main Camera").GetComponent <timer>(); stringRecords.Clear(); for (int i = 0; i < 5; i++) { records[i] = PlayerPrefs.GetFloat(level.ToString() + i.ToString()); stringRecords.Add(time.TimeToString(records[i])); } }
// void Update () { // foreach(Touch touch in Input.touches){ // if (touch.phase == TouchPhase.Began){ // // //check if mouse position is on the spawn // RaycastHit2D ray = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition),Vector2.zero,Mathf.Infinity, 1<<12); // if(ray){ // //destroy existing opulse // GameObject p = GameObject.Find("oPulse(Clone)"); // if (p != null){ // Destroy(p); // }//creat new pulse // Instantiate(oPulse,new Vector2( Camera.main.ScreenToWorldPoint(Input.mousePosition).x,5f),Quaternion.identity); // } // } // } // // if mouse leftclick // if(Input.GetMouseButtonDown(0) && !data.online){ // // //check if mouse position is on the spawn // RaycastHit2D ray = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition),Vector2.zero,Mathf.Infinity, 1<<12); // if(ray){ // //destroy existing pulse // GameObject p = GameObject.Find("oPulse(Clone)"); // if (p != null){ // Destroy(p); // }//creat new pulse // Instantiate(oPulse,new Vector2( Camera.main.ScreenToWorldPoint(Input.mousePosition).x,5f),Quaternion.identity); // } // } // } IEnumerator OnTriggerEnter2D(Collider2D collider) { if (collider.tag == "Pulse") { // health --; ???????? if (/*Advertisement.IsReady() &&*/ data.level % 5 == 0) { //Advertisement.Show(); } winAnnouncer.winLevel = true; winAnnouncer.winTime = winAnnouncer.time; data.saveRecord(winAnnouncer.winTime); Destroy(collider.gameObject); print(winAnnouncer.winTime); data.currentWinRecord = winAnnouncer.TimeToString(winAnnouncer.winTime); GameObject.Find("Canvas").SetActive(false); GameObject.Find("EventSystem").SetActive(false); yield return(new WaitForSeconds(.0f)); Application.LoadLevelAdditive("WinPage"); Destroy(gameObject.gameObject); } }