示例#1
0
 private void OnApplicationPause(bool pause)
 {
     if (pause)
     {
         SaveSerial.SaveGame();
     }
 }
示例#2
0
 public void Start()
 {
     saveSerial = GetComponent <SaveSerial>();
     saveSerial.LoadGame();
     points.ChangePointsView(saveSerial.PointsCurrentValue);
     loaderOpenLevels.LoadOpenLevels(saveSerial.OpenLevels);
 }
示例#3
0
    void Awake()
    {
        if (SceneManager.GetActiveScene().name == "Main")
        {
            if (!isGameLoaded)
            {
                Upgrade.Init();
                SaveSerial.LoadGame();

                isGameLoaded = true;
            }
        }
        if (SceneManager.GetActiveScene().name == "UpgradesMenu")
        {
            //if (!isUpMenuLoaded)
            {
                DescriptionPanel  = GameObject.Find("Canvas/DescriptionPanel");
                UpUseButton       = GameObject.Find("Canvas/DescriptionPanel/UpUseBtn");
                UpUseBtnText      = GameObject.Find("Canvas/DescriptionPanel/UpUseBtn/UpUseBtnTEXT").GetComponent <Text>();
                UpNameText        = GameObject.Find("Canvas/DescriptionPanel/UpNameText").GetComponent <Text>();
                UpDescriptionText = GameObject.Find("Canvas/DescriptionPanel/UpDescriptionText").GetComponent <Text>();
                //isUpMenuLoaded = true;
            }
            DescriptionPanel.SetActive(false);
        }
    }
示例#4
0
    void Awake()
    {
        #region singleton
        if (SAVE != null && SAVE != this)
        {
            //Debug.LogError("Destroyed newer save");
            Destroy(this);
            return;
        }
        else
        {
            SAVE = this;
            // cant do this in editor
            if (Application.isPlaying)
            {
                DontDestroyOnLoad(SAVE);
            }
        }
        #endregion

        // initializes long array
        if (SaveLoad.SaveData == null)
        {
            SaveLoad.SaveData = new long[SaveLoad.SaveDataSize];
        }

        LoadGame();
        Debug.Log("Sapient level is: " + sapientLevel);
    }
示例#5
0
    private void Start()
    {
        save = FindObjectOfType <SaveSerial>();

        dialogue        = GetComponent <Dialogue>();
        dialogueManager = GetComponent <DialogueManager>();

        dialogueText = dialogueTextObject.GetComponent <TextMeshProUGUI>();
    }
示例#6
0
    // delete the game file and clear all current vars
    public void ClearScore()
    {
        sfx.PlayButtonClick();

        PlayerPrefs.DeleteAll();

        SaveSerial clearer = new SaveSerial();

        clearer.ClearData();
        LoadScore(); // update info on screen
    }
示例#7
0
    public void TryPayToOpenLevel()
    {
        if (points.PointsCount >= payPrice)
        {
            points.PointsReduct(payPrice);
            saveSerial = linksContainer.SaveSerial;
            saveSerial.SaveParameters(points.PointsCount, LevelNumber);

            OpenLevel();
        }
        else
        {
            linksContainer.NoOpenLevelAnimation();
        }
    }
示例#8
0
    public void SaveScore(string scoreName)
    {
        sfx.PlayButtonClick();

        SaveSerial saver    = new SaveSerial();
        int        scoreInt = scorePlayerOne;

        //THIS IF BLOCK IS FOR TESTING SCORE SAVING
        if (SceneManager.GetActiveScene().name == "MainMenu")
        {
            scoreInt  = int.Parse(TEST_newScoreVal.text);
            scoreName = TEST_newScoreName.text;
        }

        saver.SaveGame(scoreName, scoreInt);

        // call loadScore again to update vars
        LoadScore();
    }
示例#9
0
    //open game file and load all vars
    public void LoadScore()
    {
        SaveSerial loader = new SaveSerial();

        loader.LoadGame();
        string scoreList = "";

        foreach (HighScoreEntry a in loader.HighScoreList)
        {
            scoreList += a.name + " - " + a.score + '\n';
        }

        if (SceneManager.GetActiveScene().name == "MainMenu")
        {
            highScoreListText = scoreList;
        }
        highScore     = loader.HighScoreList[0].score;
        highScoreName = loader.HighScoreList[0].name;
        lowScore      = loader.HighScoreList[loader.HighScoreList.Count - 1].score;

        // Debug.Log(scoreList);
    }
示例#10
0
    private void Start()
    {
        save = FindObjectOfType <SaveSerial>();

        // Needs to be set as something at the start to avoid errors.
        dialogue        = fridge.GetComponent <Dialogue>();
        dialogueManager = GetComponent <DialogueManager>();

        color = bubbleSpriteRenderer.color;

        bubbleText = bubbleTextObject.GetComponent <TextMeshProUGUI>();

        Debug.Log("Aloe watered? " + save.aloeWatered + " Aloe level? :" + save.aloeLevel);

        switch (save.aloeLevel)
        {
        case 1:
            aloeSprite.sprite = healedAloe;
            break;

        case 2:
            aloeSprite.sprite = growingAloe;
            break;

        case 3:
            aloeSprite.sprite = grownAloe;
            break;
        }
        #region randomPlacement(A joke, don't use in actual game)

        /*randX = Random.Range(xMin, xMax);
         * newPos.x = randX;
         * newPos.y = transform.position.y;
         * transform.Translate(newPos);
         * Debug.Log(newPos);*/
        #endregion
    }
示例#11
0
 private void Awake()
 {
     SetUpSingleton();
     instance = this;
 }
示例#12
0
 private void Awake()
 {
     levelParameters = new int[SettingsCount];
     saveSerial      = GetComponent <SaveSerial>();
 }
示例#13
0
 public void LoadProgress()
 {
     saveSerial = GetComponent <SaveSerial>();
     saveSerial.LoadGame();
     points.ChangePointsView(saveSerial.PointsCurrentValue);
 }