Big script cleanup. Remove the examples from Ropes' external package
This commit is contained in:
103
Assets/Scripts/Core/GameSettings.cs
Normal file
103
Assets/Scripts/Core/GameSettings.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// ScriptableObject for storing and configuring all game settings, including player, follower, and item configuration.
|
||||
/// </summary>
|
||||
[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;
|
||||
public enum HoldMovementMode { Pathfinding, Direct }
|
||||
public HoldMovementMode defaultHoldMovementMode = HoldMovementMode.Pathfinding;
|
||||
|
||||
[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;
|
||||
|
||||
[Header("Endless Descender Settings")]
|
||||
[Tooltip("How quickly the character follows the finger horizontally (higher = more responsive)")]
|
||||
public float endlessDescenderLerpSpeed = 12f;
|
||||
[Tooltip("Maximum horizontal offset allowed between character and finger position")]
|
||||
public float endlessDescenderMaxOffset = 3f;
|
||||
[Tooltip("Minimum allowed X position for endless descender movement")]
|
||||
public float endlessDescenderClampXMin = -3.5f;
|
||||
[Tooltip("Maximum allowed X position for endless descender movement")]
|
||||
public float endlessDescenderClampXMax = 3.5f;
|
||||
[Tooltip("Exponent for speed drop-off curve (higher = sharper drop near target)")]
|
||||
public float endlessDescenderSpeedExponent = 2.5f;
|
||||
|
||||
[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;
|
||||
/// <summary>
|
||||
/// Singleton instance of GameSettings loaded from Resources.
|
||||
/// </summary>
|
||||
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;
|
||||
public static float EndlessDescenderLerpSpeed => Instance.endlessDescenderLerpSpeed;
|
||||
public static float EndlessDescenderMaxOffset => Instance.endlessDescenderMaxOffset;
|
||||
public static float EndlessDescenderClampXMin => Instance.endlessDescenderClampXMin;
|
||||
public static float EndlessDescenderClampXMax => Instance.endlessDescenderClampXMax;
|
||||
public static float EndlessDescenderSpeedExponent => Instance.endlessDescenderSpeedExponent;
|
||||
}
|
||||
Reference in New Issue
Block a user