Exemplo n.º 1
0
    // Return true if load successful, false otherwise
    public bool LoadGame(int saveNumber, PlayerCharacterData playerCharacterData)
    {
        SaveData data = SaveSystem.LoadPlayerData(saveNumber);

        if (data != null) //savefile exists
        {
            // World Data (Singleplayer Only)
            worldData.SetWorldType(data.worldType);
            worldData.SetGameEnding(data.gameEnding);
            worldData.SetBossesDefeated(data.bossesDefeated);
            worldData.SetFinishGameTime(data.finishGameTime);
            worldData.SetPlayTime(data.playTime);
            // Player Data (Singleplayer Only)
            playerCharacterData.SetCurrentHP(data.currentHP);
            playerCharacterData.SetPrimaryWeapon(data.primaryWeapon);
            playerCharacterData.SetSecondaryWeapon(data.secondaryWeapon);
            playerCharacterData.SetLocationSceneIndex(data.locationSceneIndex);

            return(true);
        }
        else //savefile does not exist
        {
            return(false);
        }
    }