Beispiel #1
0
    public void Update()
    {
        if (LoadActive)
        {
            time1 += Time.deltaTime;
            loadObj.SetActive(true);
            fpc.enabled          = false;
            camera.enabled       = false;
            cameraEffect.enabled = false;
            if (time1 >= timeEnd1 && time1 < timeEnd1 + 0.1f)
            {
                Stream          stream = File.Open(Application.dataPath + SAVE_FILE + FILE_EXTENSION, FileMode.Open);
                BinaryFormatter bf     = new BinaryFormatter();

                salv = (SaveAndLoadVariable)bf.Deserialize(stream);
                stream.Close();

                //mushroomActive
                if (!salv.obj_01)
                {
                    obj_01.SetActive(false);
                }
                else
                {
                    obj_01.SetActive(true);
                }

                if (!salv.obj_02)
                {
                    obj_02.SetActive(false);
                }
                else
                {
                    obj_02.SetActive(true);
                }

                if (!salv.obj_03)
                {
                    obj_03.SetActive(false);
                }
                else
                {
                    obj_03.SetActive(true);
                }

                if (!salv.obj_04)
                {
                    obj_04.SetActive(false);
                }
                else
                {
                    obj_04.SetActive(true);
                }

                if (!salv.obj_05)
                {
                    obj_05.SetActive(false);
                }
                else
                {
                    obj_05.SetActive(true);
                }



                playerPos = new Vector3(salv.positionPlayerX, salv.positionPlayerY, salv.positionPlayerZ);

                GeneralSaveAndLoad.player.position = playerPos;

                QuestCurrent.mission_01 = salv.mission_01;
                QuestCurrent.mission_02 = salv.mission_02;
                MushroomItem.items      = salv.mushroomQuantity;
            }
            if (time1 >= timeEnd2)
            {
                loadObj.SetActive(false);
                LoadActive           = false;
                time1                = 0;
                fpc.enabled          = false;
                camera.enabled       = false;
                cameraEffect.enabled = false;
            }
        }

        if (SaveActive)
        {
            saveObj.SetActive(true);
            time2 += Time.deltaTime;
            if (time2 >= timeEnd3)
            {
                saveObj.SetActive(false);
                SaveActive = false;
                time2      = 0f;
            }
        }
    }
Beispiel #2
0
 private void Awake()
 {
     salv = new SaveAndLoadVariable();
 }