예제 #1
0
    public void ExitLoad(int index)
    {
        ExitData3x3 data = SavingSystem.ExitGameLoad3x3();
        string      Tile = "Tiles";

        if (PlayerPrefs.GetInt("Theme") == 0 || PlayerPrefs.GetInt("FirstTimeL") == 1)
        {
            foreach (Transform tile in PlayGrid)
            {
                Destroy(tile.gameObject);
            }
        }
        else if (PlayerPrefs.GetInt("Theme") == 1)
        {
            foreach (Transform tile in PlayGrid)
            {
                Destroy(tile.gameObject);
            }
        }
        for (i = 0; i < data.exitX.Count; i++)
        {
            x          = data.exitX[index];
            y          = data.exitY[index];
            Grid[x, y] = (GameObject)Instantiate(Resources.Load(Tile), new Vector2(.18f + (1.48f * data.exitX[index]), .18f + (1.48f * data.exitY[index])), Quaternion.identity);
            if (PlayerPrefs.GetInt("Theme") == 0 || PlayerPrefs.GetInt("FirstTimeL") == 1)
            {
                Grid[x, y].transform.SetParent(PlayGrid);
            }
            else if (PlayerPrefs.GetInt("Theme") == 1)
            {
                Grid[x, y].transform.SetParent(PlayGrid);
            }
            Grid[x, y].GetComponent <Tiles>().Number = data.exitTileNumber[index];
            index++;
        }
        theScore = data.exitScore;
    }