using System.Collections; using System.Collections.Generic; using UnityEngine; public class SettingsPersistance : MonoBehaviour { public static SettingsPersistance INSTANCE; [HideInInspector] public Difficulty difficulty; [HideInInspector] public int turnDuration; [HideInInspector] public int maxPoints; void Awake() { if (INSTANCE == null) { DontDestroyOnLoad(gameObject); INSTANCE = this; } if (INSTANCE != this) { Destroy(gameObject); } defaultValues(); } private void defaultValues() { difficulty = new Easy(); turnDuration = 8; maxPoints = 3; } } public abstract class Difficulty { protected float costModifier; protected float speed; protected float jumpForce; protected float force; protected float maxStamina; protected float speedModifier; public float getCostModifier() { return costModifier; } public float getSpeed() { return speed; } public float getJumpForce() { return jumpForce; } public float getForce() { return force; } public float getMaxStamina() { return maxStamina; } public float getSpeedModifier() { return speedModifier; } } public class Easy : Difficulty { public Easy() { costModifier = 1; speed = 4; jumpForce = 5; force = 0.8f; maxStamina = 20; speedModifier = 2; } } public class Normal : Difficulty { public Normal() { costModifier = 2; speed = 3; jumpForce = 4; force = 0.8f; maxStamina = 15; speedModifier = 1.5f; } } public class Hard : Difficulty { public Hard() { costModifier = 3; speed = 2; jumpForce = 3; force = 0.5f; maxStamina = 15; speedModifier = 1.2f; } }