// Use this for initialization void Start() { setshared(); if (sharedobj.getIsGameStarted() == true) { //Debug.Log(sharedobj.getBallsVector3()); GameObject.Find("mainmenu").SetActive(false); //GameObject StartGame_temp = GameObject.Find("StartGame"); //GameObject.Find("StartGame").SetActive(true); setactive_Obj.SetActive(true); GameObject.Find("numbernowText").GetComponent <Text>().text = sharedobj.getCurentNumber().ToString(); GameObject.Find("timernowText").GetComponent <Text>().text = sharedobj.getTimerForEveryone().ToString(); //GameObject[] gg = new GameObject[sharedobj.getCountNum()]; //GameObject gg = new GameObject(); //gg= sharedobj.getTemp(); //gg = sharedobj.getBalls(); Debug.Log(";"); //GameObject.Find("setting").SetActive(false); //GameObject.Find("SetPlayers").SetActive(false); } //Debug.Log(PlayerPrefs.GetInt("IsGameStarted")); //Debug.Log(PlayerPrefs.GetInt("IsGameStarted1")); //Debug.Log(sharedobj.getIsGameStarted()); //if(PlayerPrefs.GetInt("IsGameStarted1") == 1) }
private void SetSpriteBallSelected() //تنظیم عکس توپهای انتخاب شده { for (int i = 0; i < numCount; i++) { if (i < sharedobj.getCurentNumber()) { GameObject.Find(i.ToString()).GetComponent <Image>().sprite = ColorSprite[5]; GameObject.Find(i.ToString()).GetComponent <Button>().interactable = false; } } }
public void ClickBall( ) { if (this.gameObject.GetComponentInChildren <Text>().text == sharedobj.getCurentNumber().ToString()) { if (!sharedobj.getHardLevel()) { this.gameObject.GetComponent <Image>().sprite = DisableBall; this.gameObject.GetComponent <Button>().interactable = false; } sharedobj.setCurentNumber(sharedobj.getCurentNumber() + 1); sharedobj.setPlayersScoreListIndex(sharedobj.getPlayersScoreListIndex(sharedobj.getPlayersTurn() - 1) + 1, sharedobj.getPlayersTurn() - 1); //Debug.Log("score player num" +sharedobj.getPlayersTurn() + " : " + sharedobj.getPlayersScoreListIndex(sharedobj.getPlayersTurn()-1)); } }
// Update is called once per frame void Update() { if (sharedobj.getPlayersCount() != 1) { // مود چند نفره if (StartTime >= 0.0f && cancount) { StartTime -= Time.deltaTime; //alarm.SetActive(true); //Debug.Log((int) StartTime + " " + (int)StartTime % 2); if (((int)StartTime <= 5) && ((int)StartTime % 2 == 1) && cancount) { alarm.SetActive(act); act = !act; //Debug.Log(StartTime); } } else if (StartTime <= 0.0f && !doonce) { cancount = false; doonce = true; StartTime = 0.0f; //Debug.Log(StartTime); alarm.SetActive(false); EndTime(); } } else { // مود تک نفره //StartTime = 0.0f; float t = Time.time; // h = h+ (int)(t/3600); // m =m+ (int) ((t % 3600)/60); // float s =((t % 3600) % 60); m = ((int)t / 60); string s = (t % 60).ToString("f2"); TimerText.GetComponent <Text>().text = m.ToString() + ":" + s; //Debug.Log(t); if (sharedobj.getCurentNumber() > sharedobj.getCountNum()) { sharedobj.setRecordOnePersonMode(m.ToString() + ":" + s); } } // float t =Time.time - StartTime; // Debug.Log(int.Parse( sharedobj.getTimerForEveryone()) + " " + (int)(t % 60 ) + " sssssssss"); // string secend = ((t % 60 ) ).ToString("00"); // if(sharedobj.getTimerForEveryone() == secend ) //5 secend aakhar // { // Debug.Log("end"); // alarm.SetActive(true); // //alarm.SetActive(!act) ; // //act = !act; // // if (int.Parse( sharedobj.getTimerForEveryone()) == ( (int)(t % 60 ))) // // { // // SceneManager.LoadScene("mainpage"); // // } // } }