コード例 #1
0
ファイル: SaveLoadRoom1.cs プロジェクト: kromilka/BigProblem
    void Awake()
    {
        if (roomname != "Room3")
        {
            scrSp = itSpawn.GetComponent <itemSpawn>();
        }
        scrEx = ex.GetComponent <trans>();
        /*loading*/
        if (PlayerPrefs.HasKey(roomname))
        {
            temp  = PlayerPrefs.GetString(roomname);
            saved = JsonUtility.FromJson <Data>(temp);

            if (roomname != "Room3")
            {
                if (saved.openCh)
                {
                    itSpawn.SetActive(false); scrSp.isEnd = true;
                }
            }


            foreach (GameObject i in GameObject.FindGameObjectsWithTag("quest"))
            {
                Destroy(i);
            }
            for (int i = 0; i < saved.tr.Length; i++)
            {
                if (saved.name[i].Contains("shest"))
                {
                    Instantiate(shest, saved.tr[i], Quaternion.identity);
                }
                else if (saved.name[i].Contains("klu"))
                {
                    Instantiate(klu, saved.tr[i], Quaternion.identity);
                }
                else if (saved.name[i].Contains("list"))
                {
                    Instantiate(lis, saved.tr[i], Quaternion.identity);
                }
                else if (saved.name[i].Contains("otv"))
                {
                    Instantiate(otv, saved.tr[i], Quaternion.identity);
                }
                else if (saved.name[i].Contains("key"))
                {
                    Instantiate(ke, saved.tr[i], Quaternion.identity);
                }
                else if (saved.name[i].Contains("chip"))
                {
                    Instantiate(chp, saved.tr[i], Quaternion.identity);
                }
            }
        }
    }
コード例 #2
0
ファイル: itemSpawn.cs プロジェクト: 901/tetris-hologram
 void Awake()
 {
     S = this;
 }