Exemplo n.º 1
0
    public void LoadUserData()
    {
        UserData _data = SaveLoadSystem.LoadData();

        if (_data != null)
        {
            _dataExists = true;
            Account.Current.SetID(_data.ID);
            Account.Current.SetUsername(_data.Username);
        }
        else
        {
            _dataExists = false;
            Debug.Log("No user data found. Starting clear client.");
        }
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Awake()
    {
        GameData data = SaveLoadSystem.LoadData();

        if (data != null)
        {
            GlobalVariables.isShieldBought        = data.isShieldBought;
            GlobalVariables.isSwordBought         = data.isSwordBought;
            GlobalVariables.isInfinityBought      = data.isInfinityBought;
            GlobalVariables.playerCoins           = data.playerCoins;
            GlobalVariables.highestScore          = data.highestScore;
            GlobalVariables.isGamePlayedFirstTime = data.isGamePlayedFirstTime;
        }

        menuScreen.SetActive(true);
        rateButton.SetActive(true);
        rateText.SetActive(true);
        creditsScreen.SetActive(false);
        shopScreen.SetActive(false);
    }
Exemplo n.º 3
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         GameDataSL gdsl = SaveLoadSystem.LoadData();
         maxTime           = gdsl.maxTime;
         increaseTime      = gdsl.increaseTime;
         coins             = gdsl.coins;
         priceMaxTime      = gdsl.priceMaxTime;
         priceIncreaseTime = gdsl.priceIncreaseTime;
         bestScore         = gdsl.bestScore;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
         return;
     }
     DontDestroyOnLoad(gameObject);
 }
Exemplo n.º 4
0
    private void LoadGame()
    {
        GameData data = SaveLoadSystem.LoadData();

        for (int i = 0; i < data.planetsCount; i++)
        {
            PlanetData planet = data.planets[i];
            planetSpawner.LoadPlanet(planet.position, planet.radius, planet.rotationSpeed, planet.weaponType, planet.color, planet.hpAmount, planet.hpCurrent, planet.weight);

            if (planet.isPlayer)
            {
                LoadPlayer(planetMovement.planets[i]);
            }
        }

        FinishSetup();

        planetMovement.StartMovement();

        PlayerPrefs.SetString(PrefsNames.GAME_MODE, PrefsNames.GAME_MODE_NEW_GAME);
    }
Exemplo n.º 5
0
    private void Awake()
    {
        _saveLoadSystem = new SaveLoadSystem();

        var itemsSettings = Resources.LoadAll <ItemSettings>(string.Empty);

        var loadedItems = _saveLoadSystem.LoadData();

        Item       tempItem       = null;
        ItemObject tempItemObject = null;

        foreach (var itemSetings in itemsSettings)
        {
            tempItem             = new Item(itemSetings);
            tempItem.InInventory = loadedItems.Exists(x => x.ItemID == itemSetings.ItemID);

            tempItemObject = Instantiate(_itemObjectPrefab).GetComponent <ItemObject>();

            tempItemObject.Initialize(tempItem);
            _itemObjects.Add(tempItemObject);
        }

        inventorySystem.Initialize(_itemObjects, _saveLoadSystem);
    }