我有这个 ScriptableObject,我想在创建时为每张卡片添加一个效果;我有一个名为“EffectManager”的脚本,它有一些方法作为效果。
这是我的卡片脚本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "New Card", menuName = "Card")]
public class Card : ScriptableObject
{
public string m_cardName;
public Sprite m_sprite;
public int m_manaCost;
public int m_health;
public int m_attack;
}
这是我的 EffectManager 脚本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EffectManager : MonoBehaviour
{
Deck dk;
Hand hnd;
Player p1;
private void Awake()
{
dk = GameObject.FindObjectOfType<Deck>();
hnd = GameObject.FindObjectOfType<Hand>();
jg1 = GameObject.FindObjectOfType<Player>();
}
public void draw(int num)
{
jg1.DrawCards(num);
}
public void discard()
{
hnd.hand.RemoveAt(0);
}
private void mill()
{
dk.deck.RemoveAt(0);
}
}
我怎样才能使我创建的每张卡都具有与之关联的效果,该效果会在满足条件时激活?(在这种情况下,它会在卡片被召唤时)