using System.Collections; using System.Collections.Generic; using Beyond; using Invector.vCharacterController; using Invector.vMelee; using PixelCrushers; using PixelCrushers.DialogueSystem; using UnityEngine; using UnityEngine.SceneManagement; using PixelCrushers.QuestMachine; using UnityEditor; using System.ComponentModel; public partial class SROptions { private const int VERSION = 1988; private bool m_fastRunning = false; private bool m_damageBooster; private bool m_immortal = false; // --- STAMINA SETTINGS --- private float m_staminaRegen = 0.6f; // Default Invector Value private float m_maxStamina = 100f; // Default Invector Value private Quest m_currentQuest; [Category("Build")] public string Version { get { //return PlayerSettings.iOS.buildNumber; var bv = Resources.Load("Build"); return bv.version; } } [Category("Scenes")] [field: Range(0, 10)] public int SceneToLoad { get; set; } = 0; [Category("Scenes")] // Options will be grouped by category public void LoadSeleced() { //SaveSystem.LoadScene($"index:{SceneToLoad}"); ProxySceneLoader.LoadScene($"index:{SceneToLoad}"); } [Category("Quests Controll")] public string QuestIdToActive { get; set; } [Category("Locomotion")] public bool FastRunning { get { return m_fastRunning; } set { m_fastRunning = value; var tp = Player.Instance.GetComponent(); if (tp) tp.freeSpeed.runningSpeed = value ? 10f : 1f; } } [Category("Locomotion")] public void Spawn1() { SpawnTelepoerter.Instance.SpawnToPoint(0); } [Category("Locomotion")] public void Spawn2() { SpawnTelepoerter.Instance.SpawnToPoint(1); } [Category("Locomotion")] public void Spawn3() { SpawnTelepoerter.Instance.SpawnToPoint(2); } [Category("Locomotion")] public void SetNormalSpeed() { var tp = Player.Instance.GetComponent(); if (tp) { tp.speedMultiplier = 1f; tp.freeSpeed.movementSmooth = 6f; tp.freeSpeed.animationSmooth = 0.2f; tp.freeSpeed.rotationSpeed = 4; tp.freeSpeed.walkSpeed = 1f; tp.freeSpeed.runningSpeed = 1f; tp.freeSpeed.sprintSpeed = 2f; tp.freeSpeed.crouchSpeed = 2f; } } [Category("Locomotion")] public void SetHightSpeed() { var tp = Player.Instance.GetComponent(); if (tp) { tp.speedMultiplier = 1.1f; tp.freeSpeed.movementSmooth = 10f; tp.freeSpeed.animationSmooth = 0.12f; tp.freeSpeed.rotationSpeed = 9; tp.freeSpeed.walkSpeed = 1.1f; tp.freeSpeed.runningSpeed = 1.2f; tp.freeSpeed.sprintSpeed = 2.5f; tp.freeSpeed.crouchSpeed = 2.5f; } } [Category("Locomotion")] public void SetVHightSpeed() { var tp = Player.Instance.GetComponent(); if (tp) { tp.speedMultiplier = 1.2f; tp.freeSpeed.movementSmooth = 15f; tp.freeSpeed.animationSmooth = 0.08f; tp.freeSpeed.rotationSpeed = 12; tp.freeSpeed.walkSpeed = 1.3f; tp.freeSpeed.runningSpeed = 1.4f; tp.freeSpeed.sprintSpeed = 3f; tp.freeSpeed.crouchSpeed = 3f; } } [Category("Combat")] public bool DamageBooster { get { return m_damageBooster; } set { m_damageBooster = value; var mm = Player.Instance.GetComponent(); if (mm) { mm.rightWeapon.damageModifier = value ? 100 : 0; } } } [Category("Combat")] public bool Immortal { get { return m_immortal; } set { m_immortal = value; Player.Instance.ThirdPersonController.GodMode = value; } } [Category("Stats")] [DisplayName("Stamina Regen Rate")] [Increment(0.1f)] // Optional attribute for SRDebugger slider/buttons public float StaminaRegen { get { if (Player.Instance && Player.Instance.ThirdPersonController) { return Player.Instance.ThirdPersonController.staminaRecovery; } return m_staminaRegen; } set { m_staminaRegen = value; if (Player.Instance && Player.Instance.ThirdPersonController) { Player.Instance.ThirdPersonController.staminaRecovery = value; } } } [Category("Stats")] [DisplayName("Max Stamina")] [Increment(10f)] public float MaxStamina { get { if (Player.Instance && Player.Instance.ThirdPersonController) { return Player.Instance.ThirdPersonController.maxStamina; } return m_maxStamina; } set { m_maxStamina = value; if (Player.Instance && Player.Instance.ThirdPersonController) { // Set the Max value Player.Instance.ThirdPersonController.maxStamina = value; // Optional: Refill current stamina so you see the bar grow immediately // Player.Instance.ThirdPersonController.currentStamina = value; } } } [Category("Stats")] [DisplayName("Roll Stamina Cost")] [Increment(5f)] // Allows changing values by 5 in the debugger public float RollStaminaCost { get { if (Player.Instance && Player.Instance.ThirdPersonController) { return Player.Instance.ThirdPersonController.rollStamina; } return 20f; // Return a safe default if player isn't found } set { if (Player.Instance && Player.Instance.ThirdPersonController) { Player.Instance.ThirdPersonController.rollStamina = value; } } } [Category("Stats")] public void ResetStaminaDefaults() { StaminaRegen = 0.6f; MaxStamina = 100f; } [Category("Save")] public void SaveGame() { SaveSystem.SaveToSlot(6); } [Category("Save")] public void LoadGame() { SaveSystem.LoadFromSlot(6); } [Category("Save")] public void LoadLastCheckpoint() { SaveUtility.Instance.LoadCheckpoint(); } [Category("Save")] public void SaveLastCheckpoint() { SaveUtility.Instance.SaveCheckpoint(); } [Category("Save")] public void ClearLastCheckpoint() { SaveUtility.Instance.ClearCheckpoint(); } [Category("Quests Controll")] public void ActiveQuest() { m_currentQuest = QuestMachine.GiveQuestToQuester(QuestIdToActive, "Bascileus"); } [Category("Quests Controll")] public void CompleteQuestPart() { var journal = QuestMachine.GetQuestJournal(); if (!m_currentQuest || m_currentQuest.GetState() == PixelCrushers.QuestMachine.QuestState.Successful) { for (int i = 0; i < journal.questList.Count; i++) { var quest = journal.questList[i]; if (!quest.isTrackable || quest.GetState() == PixelCrushers.QuestMachine.QuestState.Successful) { continue; } m_currentQuest = quest; break; } } for (int i = 0; i < m_currentQuest.nodeList.Count; i++) { if (m_currentQuest.nodeList[i].GetState() == QuestNodeState.True) { continue; } if (m_currentQuest.nodeList[i].GetState() == QuestNodeState.Active) { m_currentQuest.nodeList[i].SetState(QuestNodeState.True); break; } } } [Category("Items")] public int ItemId { get; set; } [Category("Items")] public int ItemAmount { get; set; } [Category("Items")] public void AddItem() { Player.Instance.ItemManager.AddItemsByID(ItemId, ItemAmount); } [Category("Skills")] public Skills skillToLevelUp { get; set; } [Category("Skills")] public void LvlUpSkill() { SkillsManager.instance.LevelUpSkill(skillToLevelUp); } [Category("Guilts")] public void OpenScrollOfAccusation() { var m_mainMenuController = Player.Instance.transform.parent.GetComponentInChildren(); if (m_mainMenuController == null) { Debug.LogError("There is no MainMenuController on Scene"); return; } m_mainMenuController.OpenJudgementMenu(); } [Category("Guilts")] public string GuiltId { set; get; } [Category("Guilts")] public void ActiveGuilt() { QuestMachine.GiveQuestToQuester(GuiltId, "Bascileus"); } [Category("Language")] public void SetEnglish() { DialogueManager.instance.SetLanguage("en"); } [Category("Language")] public void SetPolish() { DialogueManager.instance.SetLanguage("pl"); } }