private void OnApplicationPause(bool pause) { if (pause) { SaveSerial.SaveGame(); } }
public void Start() { saveSerial = GetComponent <SaveSerial>(); saveSerial.LoadGame(); points.ChangePointsView(saveSerial.PointsCurrentValue); loaderOpenLevels.LoadOpenLevels(saveSerial.OpenLevels); }
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); } }
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); }
private void Start() { save = FindObjectOfType <SaveSerial>(); dialogue = GetComponent <Dialogue>(); dialogueManager = GetComponent <DialogueManager>(); dialogueText = dialogueTextObject.GetComponent <TextMeshProUGUI>(); }
// 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 }
public void TryPayToOpenLevel() { if (points.PointsCount >= payPrice) { points.PointsReduct(payPrice); saveSerial = linksContainer.SaveSerial; saveSerial.SaveParameters(points.PointsCount, LevelNumber); OpenLevel(); } else { linksContainer.NoOpenLevelAnimation(); } }
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(); }
//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); }
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 }
private void Awake() { SetUpSingleton(); instance = this; }
private void Awake() { levelParameters = new int[SettingsCount]; saveSerial = GetComponent <SaveSerial>(); }
public void LoadProgress() { saveSerial = GetComponent <SaveSerial>(); saveSerial.LoadGame(); points.ChangePointsView(saveSerial.PointsCurrentValue); }