Beispiel #1
0
 private void Start()
 {
     warningScript   = WarningScript.Instance;
     Building        = BuildingFactory.GetBuilding(buildingType); // Building kendi classının butondan gönderildiği üzere factory'den yaratıyor.
     InfoImageObject = GameObject.FindWithTag("InfoImageObject");
     InfoTextObject  = GameObject.FindWithTag("InfoTextObject");
     ClickManager.NonClickableObject += BuildingSet; // VirtualBuilding kurulumu yapıldıktan sonra nonClickable olarak işaretlenmiş terrain'a tıklandığında
                                                     // RealBuilding oluşturuluyor.
     CreateVirtualBuilding();
     Building.giveInfoLog();                         // Bina yaratıldığında iki farklı class için farklı çalışan info fonksiyonu
 }
Beispiel #2
0
    void Start()
    {
        theEnd.SetActive(false);
        camEdge         = GameObject.Find("Main Camera").GetComponent <WarningScript> ();
        camEdge.enabled = false;

        userInfo = new UserInfo();
        if (PlayerPrefs.GetInt("JsonOn") != 0)
        {
            string jsonUserInfo = PlayerPrefs.GetString("JsonUserInfo");
            userInfo = JsonReader.Deserialize <UserInfo> (jsonUserInfo);
            //score = userInfo.currentScore;
        }
        PlayerPrefs.SetInt("JsonOn", 1);

        max         = width * 14;
        arrayPuzzle = new int[width * height];
        objPuzzle   = new GameObject[width * height];
        for (int i = 0; i < height; i++)
        {
            for (int j = 0; j < width; j++)
            {
                int ran = Random.Range(0, 100) % 6;
                switch (ran)
                {
                case 0:
                    puzzleName = "p_red";
                    break;

                case 1:
                    puzzleName = "p_green";
                    break;

                case 2:
                    puzzleName = "p_blue";
                    break;

                case 3:
                    puzzleName = "p_yellow";
                    break;

                case 4:
                    puzzleName = "p_pupple";
                    break;

                case 5:
                    puzzleName = "p_pink";
                    break;
                }
                int ran2 = Random.Range(0, 100);
                if (ran2 == 0)
                {
                    ran        = 6;
                    puzzleName = "p_item1";
                }
                else if (ran2 == 1)
                {
                    ran        = 7;
                    puzzleName = "p_item2";
                }
                else if (ran2 == 2)
                {
                    ran        = 8;
                    puzzleName = "p_block";
                }
                objPuzzle [i * width + j] = Instantiate(Resources.Load("puzzle/" + puzzleName)) as GameObject;
                objPuzzle [i * width + j].transform.position = new Vector3(j - (width - 1) * 0.5f, i - 3, 0);
                //objPuzzle [i * width + j].transform.rotation = Quaternion.Euler (0, 180, Random.Range (-180f, 180f));
                arrayPuzzle [i * width + j]    = ran;
                objPuzzle [i * width + j].name = (i * width + j).ToString();
                objPuzzle [i * width + j].GetComponent <PuzzleCtrl> ().myKind = ran;
                objPuzzle [i * width + j].SetActive(true);
            }
        }
//		string deg = "";
//		for (int i = height; i >0; i--) {
//			for (int j = width; j >0; j--) {
//				deg += arrayPuzzle [i*width-j].ToString()+" ";
//			}
//			deg += '\n';
//		}
//		Debug.Log (deg);
    }
Beispiel #3
0
 private void Awake()
 {
     instance = this;
 }