Hello all,
I am currently working on a game inspired by Ratropolis, which means that the player will have to play cards from his hand to achieve certain actions in the world, like get some money or this kind of things.
I am not sure how to implement this, and I am very confused to say the least. Basically, so far I had been using a Scriptable Object called CardData, which looks like this : (please note that the CardsEffect line was not present until yesterday, and this is what I am confused about)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
[CreateAssetMenu]
public class CardData : ScriptableObject
{
//This will contain all the cards information.
public string cardName, description;
public int moneyCost, natureCost, foodCost;
public Texture2D texture; //this is for prototyping only, textures will be replaced by a prefab.
public CardsEffect cardEffect; // CardsEffect is a public class that I created for my spells class to Inherit from. I am not sure about this tho
}
Searching online, I saw that many people recommanded to create a public class that would hold the voids of the effects, so I could create a class for each card inheriting from it. So this is what I did :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[System.Serializable]
public class CardsEffect
{
private GameObject resourceController;
public CardsEffect()
{
}
public bool unplayable;
[Header("When played")]
public int moneyBonus;
public int natureBonus;
public int foodBonus;
[Header("When drawn")]
public int drawMoneyBonus;
public int drawNatureBonus;
public int drawFoodBonus;
public void OnDraw()
{
}
public void OnPlay()
{
}
}
But I realize I don’t really know how to use this. Basically, what I was thinking about was creating public voids in the CardsEffect class with parameters, like this so I could easily call the voids from the inheriting classes, but I’m not sure it’s good.
DrawCards(int cardsToDraw)
{
target player draws cardsToDraw cards;
}
Also, I don’t understand how to implement these classes since they don’t inherit from MonoBehaviour, I can’t attach them to my ScriptableObject, and I can’t make a CardsEffect using the voids. So as you can see, I am very confused, and I would really appreciate some advices about this.
Thanks for reading me,
Best regards