using System; using UnityEngine; namespace AppleHills.Data.CardSystem { /// /// Scriptable object defining a collectible card's properties. /// Used as a template for generating CardData instances. /// [CreateAssetMenu(fileName = "New Card", menuName = "AppleHills/Card System/Card Definition")] public class CardDefinition : ScriptableObject { [Header("Identification")] [Tooltip("Unique identifier for this card definition")] public string Id = Guid.NewGuid().ToString(); [Header("Basic Info")] public string Name; [TextArea(3, 5)] public string Description; public CardRarity Rarity; public CardZone Zone; [Header("Visual Elements")] public Sprite CardImage; // The actual card image [Header("Collection Info")] public int CollectionIndex; // Position in the album /// /// Creates a new CardData instance from this definition /// public CardData CreateCardData() { return new CardData(this); } /// /// Gets the background color for this card based on its zone /// public Color GetBackgroundColor() { // Colors based on zone switch (Zone) { case CardZone.AppleHills: return new Color(0.8f, 0.9f, 0.8f); // Light green case CardZone.Quarry: return new Color(0.85f, 0.8f, 0.7f); // Sandy brown case CardZone.Forest: return new Color(0.6f, 0.8f, 0.6f); // Forest green case CardZone.Mountain: return new Color(0.7f, 0.7f, 0.9f); // Bluish case CardZone.Beach: return new Color(0.9f, 0.85f, 0.7f); // Sandy yellow default: return Color.white; } } public override bool Equals(object obj) { if (obj is CardDefinition other) { return string.Equals(Id, other.Id, StringComparison.Ordinal); } return false; } public override int GetHashCode() { return Id != null ? Id.GetHashCode() : 0; } } }