Ejemplo n.º 1
0
 //카메라 조정 요소
 // Start is called before the first frame update
 void Start()
 {
     theFade   = FindObjectOfType <FadeManager>();
     theAudio  = FindObjectOfType <AudioManager>();
     thePlayer = FindObjectOfType <Player_Movement>();
     theGM     = FindObjectOfType <RPGGameManager>();
 }
Ejemplo n.º 2
0
 // Called just after the object is initialised
 private void Awake()
 {
     if (sharedInstance != null && sharedInstance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         sharedInstance = this;
     }
 }
Ejemplo n.º 3
0
 private void Awake()
 {
     if (instanciaCompartilhada != null && instanciaCompartilhada != this)
     {
         Destroy(gameObject);
     }
     else
     {
         instanciaCompartilhada = this;
     }
 }
Ejemplo n.º 4
0
 // Ensure only a single instance of the RPGGameManager exists
 // It's possible to get multiple instances if multiple copies of the RPGGameManager exists in the Hierarchy
 // or if multiple copes are programmatically instantiated
 public void Awake()
 {
     // if sharedInstance has been initialized, but not to the current instance, then destroy it
     if (sharedInstance != null && sharedInstance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         sharedInstance = this;
     }
 }
Ejemplo n.º 5
0
 void Awake()
 {
     if (sharedInstance != null && sharedInstance != this)
     {
         // We only ever want one instance to exist, so destroy the other existing object
         Destroy(gameObject);
     }
     else
     {
         // If this is the only instance, then assign the sharedInstance variable to the current object.
         sharedInstance = this;
     }
 }
Ejemplo n.º 6
0
    void Awake()
    {
// Check if sharedInstance is already initialized and not equal to this current instance
//There should be only one instance of RPGGameManager
        if (sharedInstance != null && sharedInstance != this)
        {
// If sharedInstance is initialized and not equal to the current instance, then destroy it
            Destroy(gameObject);
        }
        else
        {
// assign the one sharedInstance variable to the current object
            sharedInstance = this;
        }
    }
Ejemplo n.º 7
0
    // set things up here
    void Awake()
    {
        // setup reference to game manager
        if (gm_rpg == null)
        {
            gm_rpg = this.GetComponent <RPGGameManager>();
        }


        _audio = GetComponent <AudioSource> ();
        if (_audio == null)         // if AudioSource is missing
        {
            Debug.LogWarning("AudioSource component missing from this gameobject. Adding one.");
            // let's just add the AudioSource component dynamically
            _audio = gameObject.AddComponent <AudioSource>();
        }
        _audio.loop = true;

        // setup all the variables, the UI, and provide errors if things not setup properly.
        setupDefaults();
    }
Ejemplo n.º 8
0
    public void CallLoad()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Open(Application.dataPath + "/SaveFile.dat", FileMode.Open);

        if (file != null && file.Length > 0)
        {
            data = (Data)bf.Deserialize(file);

            theDatabase   = FindObjectOfType <DataBaseManager>();
            thePlayer     = FindObjectOfType <Player_Movement>();
            thePlayerStat = FindObjectOfType <Player_Stat>();
            theEquip      = FindObjectOfType <Equipment>();
            theInven      = FindObjectOfType <Inventory>();

            thePlayer.currentMapName = data.mapName;
            //thePlayer.currentSceneName = data.sceneName;

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

            thePlayerStat.character_Lv = data.playerLv;
            thePlayerStat.hp           = data.playerHP;
            thePlayerStat.mp           = data.playerMP;
            thePlayerStat.currentHp    = data.playerCurrentHP;
            thePlayerStat.currentMp    = data.playerCurrentMP;
            thePlayerStat.currentExp   = data.playerCurrentEXP;
            thePlayerStat.atk          = data.playerATK;
            thePlayerStat.def          = data.playerDEF;

            thePlayerStat.Gold = data.playerGlod;

            //호감도
            thePlayerStat.favorability_Letitia = data.favorLetitia;
            thePlayerStat.favorability_Seren   = data.favorSeren;

            theEquip.added_atk = data.added_atk;
            theEquip.added_def = data.added_def;

            //이벤트 기록
            theDatabase.has_event001        = data.HasEvent001;
            theDatabase.has_event002        = data.HasEvent002;
            theDatabase.has_eventLetitia001 = data.HasEventLetitia001;
            theDatabase.has_eventLetitia002 = data.HasEventLetitia002;
            theDatabase.has_eventLetitia003 = data.HasEventLetitia003;
            theDatabase.has_eventLetitia004 = data.HasEventLetitia004;
            theDatabase.has_eventSeren001   = data.HasEventSeren001;
            theDatabase.has_eventSeren002   = data.HasEventSeren002;
            theDatabase.has_eventSeren003   = data.HasEventSeren003;
            theDatabase.has_eventSeren004   = data.HasEventSeren004;

            theDatabase.var         = data.varNumberList.ToArray();
            theDatabase.var_name    = data.varNameList.ToArray();
            theDatabase.switches    = data.swList.ToArray();
            theDatabase.switch_name = data.swNameList.ToArray();

            for (int i = 0; i < theEquip.equipItemList.Length; i++)
            {
                for (int x = 0; x < theDatabase.itemList.Count; x++)
                {
                    if (data.playerEquipItem[i] == theDatabase.itemList[x].itemID)
                    {
                        theEquip.equipItemList[i] = theDatabase.itemList[x];
                        Debug.Log("장착된 아이템을 로드했습니다 : " + theEquip.equipItemList[i].itemID);
                        break;
                    }
                }
            }


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

            for (int i = 0; i < data.playerItemInventory.Count; i++)
            {
                for (int x = 0; x < theDatabase.itemList.Count; x++)
                {
                    if (data.playerItemInventory[i] == theDatabase.itemList[x].itemID)
                    {
                        itemList.Add(theDatabase.itemList[x]);
                        Debug.Log("인벤토리 아이템을 로드했습니다 : " + theDatabase.itemList[x].itemID);
                        break;
                    }
                }
            }

            for (int i = 0; i < data.playerItemInventoryCount.Count; i++)
            {
                itemList[i].itemCount = data.playerItemInventoryCount[i];
            }

            theInven.LoadItem(itemList);
            theEquip.ShowText();

            RPGGameManager theGM = FindObjectOfType <RPGGameManager>();
            theGM.LoadStart();

            SceneManager.LoadScene(data.mapName);
        }
        else
        {
            Debug.Log("저장된 세이브 파일이 없습니다");
        }


        file.Close();
    }