Exemplo n.º 1
0
 private void Awake()
 {
     if (instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 2
0
    void Start()
    {
        mother = UnknownManager.instance;

        mother.locationList.Add(this.transform);
    }
Exemplo n.º 3
0
    void Start()
    {
        Debug.Log("생성성공!");
        //instance = this;
        que = new Queue <Transform>();    //이동할 위치
        ObjectManager.instance.FadeIn(spriteRenderer);

        if (moveLocation.Count != 0)
        {
            for (int i = 0; i < moveLocation.Count; i++)
            {
                que.Enqueue(moveLocation[i]);
            }
        }
        thePlayer = PlayerManager.instance;
        target    = this.gameObject.transform;
        //target = thePlayer.gameObject.transform;
        //animator.SetFloat("walkSpeed", (float)(myInfo.speed/1.5f));
        animator.SetFloat("walkSpeed", 1);
        //if(onPatrol) canMove =false;
        //shadowBackup = shadow.transform;
        mother = UnknownManager.instance;


        if (!mother.activated)
        {
            mother.activated = true;
        }

        //초기설정

        //spriteRenderer.color = new Color(1,1,1,1);
        thePlayer.isChased = true;
        FadeManager.instance.unknownFog.SetActive(true);
        myInfo = mother.phases[mother.nowPhase];
        // timer = mother.phase == 0 ? 12f : 20f;
        // remainingCount = mother.phase == 0 ? 2 : 3;


        // switch(mother.nowPhase){
        //     case 0 :
        //         myInfo = mother.phases[0];
        //         // timer = mother.phases[0].timer;
        //         // remainingCount = mother.phases[0].remainingCount;
        //         // speed = mother.phases[0].speed;
        //         break;
        //     case 1 :
        //         myInfo = mother.phases[1];
        //         break;
        // }

        //myParticle.duration = myInfo.timer;

        myParticle.Stop();
        var main = myParticle.main;

        main.duration = myInfo.timer;
        myParticle.Play();

        timer          = myInfo.timer;
        remainingCount = myInfo.remainingCount;
        // timer = mother.nowPhase ==0 ? mother.phases[0].timer : mother.phases[1].timer;
        // remainingCount = mother.nowPhase ==0 ? mother.phases[0].remainingCount : mother.phases[1].remainingCount;



        //책 못열게
        //BookManager.instance.DisableBookOnBtn();
    }
Exemplo n.º 4
0
    public void CallLoad(int num)
    {
        BinaryFormatter bf = new BinaryFormatter();
        //FileStream file = File.Open(Application.dataPath + "/SaveFile1.dat", FileMode.Open);
        FileStream file = File.Open(Application.persistentDataPath + "/" + Application.version + "/SaveFile" + num + ".dat", FileMode.Open);

        if (file != null && file.Length > 0)
        {
            DatabaseManager.instance.ResetDB();

            data = (Data)bf.Deserialize(file);

            theDB      = FindObjectOfType <DatabaseManager>();
            thePlayer  = FindObjectOfType <PlayerManager>();
            theInven   = FindObjectOfType <Inventory>();
            theUnknown = FindObjectOfType <UnknownManager>();

            thePlayer.currentMapName = data.currentMapName;
            //thePlayer.lastMapName = data.lastMapName;
            thePlayer.lastMapName = "";

            thePlayer.mazeNum = data.mazeNum;

            UnknownManager.instance.nowPhase = UnknownManager.instance.CheckMaps();

            vector.Set(data.playerX, data.playerY, data.playerZ);
            thePlayer.transform.position = vector;


            theDB.doorEnabledList = data.doorEnabledList;
            theDB.doorLockedList  = data.doorLockedList;

            theDB.bookActivated = data.bookActivated;

            theDB.trigOverList = data.trigOverList;

            theDB.doneIntro                 = data.doneIntro;
            theDB.firstOpen                 = data.firstOpen;
            theDB.activateRandomAppear      = data.activateRandomAppear;
            theUnknown.activateRandomAppear = theDB.activateRandomAppear;//바로연동
//            Debug.Log("LOAD : theDB.doneIntro : "+ theDB.doneIntro);
            theDB.progress       = data.progress;
            theDB.puzzleOverList = data.puzzleOverList;
            theDB.gameOverList   = data.gameOverList;
            theDB.activatedPaper = data.activatedPaper;
            theDB.letterPaper    = data.letterPaper;


            theDB.isPlayingPuzzle2 = data.isPlayingPuzzle2;
            if (theDB.lastSaveNum != num)
            {
                theDB.caughtCount = data.caughtCount;
            }
            if (theDB.lastSaveNum != num)
            {
                theDB.gameTimer = data.gameTimer;
            }


            //////////////////////////////////////////////////ITEM

            theDB.itemOverList = data.itemOverList;



            //////////////////////////////////////////////////SETTING
            theDB.saveName    = data.saveName;
            theDB.saveTime    = data.saveTime;
            theDB.lastSaveNum = data.lastSaveNum;

            List <Item> itemList = new List <Item>();

            for (int i = 0; i < data.playerItemInventory.Count; i++)
            {
                for (int j = 0; j < theDB.itemList.Count; j++)
                {
                    if (data.playerItemInventory[i] == theDB.itemList[j].itemID)
                    {
                        itemList.Add(theDB.itemList[j]);
                        //Debug.Log("인벤토리 item 로드했습니다 : "+theDB.itemList[j].itemID);
                        break;
                    }
                }
            }

            theInven.LoadItem(itemList);

            /*LoadManager theLoad = FindObjectOfType<LoadManager>();        //필요한가?
             * theLoad.LoadStart();*/

            SelectManager.instance.ExitSelect();
            DialogueManager.instance.ExitDialogue();
            OrderManager.instance.Move();
            PlayerManager.instance.ResetPlayer();


            SceneManager.LoadScene(data.currentMapName);

            //CameraMovement.instance.SetBound(bound);
            //theLoad.Loading();
            //loading =false;
        }
        else
        {
            //Debug.Log("저장된 세이브 파일이 없습니다");
        }

        file.Close();
    }