private void LoadData() { if (savedData != null) { Debug.Log("loading"); //healt and potions healthController.currentHealth = savedData.health; healthController.MaxHealth = savedData.maxHealth; healthController.potions = savedData.healthPotions; loadSuccess = healthController.UpdateData(); //money moneySystem.coins = savedData.coins; moneySystem.UpdateData(); //resolution etc. menu.SetFullscreen(savedData.isFullScreen); menu.SetScreenSize(savedData.resolution); menu.SetVolume(savedData.volume); //quest QuestGoal[] qtypes = { QuestGoal.USE, QuestGoal.KILL, QuestGoal.ARRIVE, QuestGoal.TALK }; var quest = new Quest(qtypes[savedData.Type], savedData.Description, savedData.Reward, savedData.KillGoal, savedData.KillType, savedData.ArriveType, savedData.UseType, savedData.TalkType); quest.KillCounter = savedData.KillCounter; quest.Finished = savedData.Finished; questManager.ChangeQuest(quest); //king barriers if (king != null) { king.GetComponent <KingScript>().RemoveBlockers(savedData.questPart); } //armour blacksmith.LoadSavedArmour(savedData.armour); } }
private void Update() { if (canInteract) { if (Input.GetKeyDown(KeyCode.E) && !dialogueStart) { StartInteraction(playerInstance); } } if (canInteract && Input.GetKeyDown(KeyCode.R)) { if (!dialogueMenager.DisplayNextSentence() && questManager.quest.Finished) { if (questPart < questList.Count) { FindObjectOfType <MoneySystem>().AddCoin(questManager.quest.Reward); questManager.ChangeQuest(questList[questPart]); questBlockers[questPart].SetActive(false); dialoguePart++; questPart++; } else { FindObjectOfType <MoneySystem>().AddCoin(questManager.quest.Reward); questManager.questPanel.SetActive(false); SceneManager.LoadScene("Outro"); } StopInteracting(playerInstance); if (questPart == 1) { teleportSound.Play(); anim.SetBool("kingDisappeared", true); Invoke(nameof(Appeared), 0.5f); } } } if (!canInteract) { StopInteracting(playerInstance); } Vector3 playerSite = playerInstance.transform.position - transform.position; if (playerSite.x < 0) { transform.rotation = new Quaternion(0, 180, 0, 0); } else { transform.rotation = new Quaternion(0, 0, 0, 0); } }
private void ReloadGame() { audioSource.clip = tap; audioSource.PlayOneShot(audioSource.clip); buttonEnable = false; questManager.ChangeQuest(); player.ResetPosition(); player.EnableMovement(); HideAllCanvasGroups(); }