60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace AppleHills.Data.CardSystem
|
|
{
|
|
/// <summary>
|
|
/// Scriptable object defining a collectible card's properties.
|
|
/// Used as a template for generating CardData instances.
|
|
/// </summary>
|
|
[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;
|
|
|
|
[Tooltip("Use a custom file name instead of the card name")]
|
|
public bool UseCustomFileName = false;
|
|
|
|
[Tooltip("Custom file name (only used if UseCustomFileName is true)")]
|
|
public string CustomFileName = "";
|
|
|
|
[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
|
|
|
|
/// <summary>
|
|
/// Creates a new CardData instance from this definition
|
|
/// </summary>
|
|
public CardData CreateCardData()
|
|
{
|
|
return new CardData(this);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|