Files
AppleHillsProduction/Assets/Scripts/GameSettings.cs
2025-09-04 14:24:38 +02:00

79 lines
3.0 KiB
C#

using UnityEngine;
[CreateAssetMenu(fileName = "GameSettings", menuName = "AppleHills/GameSettings", order = 1)]
public class GameSettings : ScriptableObject
{
[Header("Interactions")]
public float playerStopDistance = 6.0f;
public float followerPickupDelay = 0.2f;
[Header("Follower Settings")]
public float followDistance = 1.5f;
public float manualMoveSmooth = 8f;
public float thresholdFar = 2.5f;
public float thresholdNear = 0.5f;
public float stopThreshold = 0.1f;
[Header("Player Settings")]
public float moveSpeed = 5f;
public float stopDistance = 0.1f;
public bool useRigidbody = true;
[Header("Backend Settings")]
[Tooltip("Technical parameters, not for design tuning")]
public float followUpdateInterval = 0.1f;
public float followerSpeedMultiplier = 1.2f;
public float heldIconDisplayHeight = 2.0f;
[Header("Default Prefabs")]
public GameObject basePickupPrefab;
[System.Serializable]
public class CombinationRule {
public PickupItemData itemA;
public PickupItemData itemB;
public PickupItemData result;
}
[System.Serializable]
public class SlotItemConfig {
public PickupItemData slotItem; // The slot object (SO reference)
public System.Collections.Generic.List<PickupItemData> allowedItems;
public System.Collections.Generic.List<PickupItemData> forbiddenItems;
}
[Header("Item Configuration")]
public System.Collections.Generic.List<CombinationRule> combinationRules;
public System.Collections.Generic.List<SlotItemConfig> slotItemConfigs;
// Singleton pattern
private static GameSettings _instance;
public static GameSettings Instance {
get {
if (_instance == null) {
_instance = Resources.Load<GameSettings>("GameSettings");
if (_instance == null) {
Debug.LogError("GameSettings asset not found in Resources folder!");
}
}
return _instance;
}
}
// Static property wrappers for easy access
public static float PlayerStopDistance => Instance.playerStopDistance;
public static float FollowerPickupDelay => Instance.followerPickupDelay;
public static float FollowDistance => Instance.followDistance;
public static float ManualMoveSmooth => Instance.manualMoveSmooth;
public static float ThresholdFar => Instance.thresholdFar;
public static float ThresholdNear => Instance.thresholdNear;
public static float StopThreshold => Instance.stopThreshold;
public static float MoveSpeed => Instance.moveSpeed;
public static float StopDistance => Instance.stopDistance;
public static bool UseRigidbody => Instance.useRigidbody;
public static float FollowUpdateInterval => Instance.followUpdateInterval;
public static float FollowerSpeedMultiplier => Instance.followerSpeedMultiplier;
public static float HeldIconDisplayHeight => Instance.heldIconDisplayHeight;
public static GameObject BasePickupPrefab => Instance.basePickupPrefab;
}