Hi all
I’m working on turn-based strategy game managing a country. So I have game objects representing each region(logically). And in that game object, the most important component is RegionObj:Monobehaviour
.
Here is the simplified version of it.
public class RegionObj:MonoBehavior {
public List<RegionComponentBase> regionComps;
public void Init()
{
regionComps.ForEach(comp => comp.Init());
}
public void Loop()
{
regionComps.ForEach(comp=>comp.Loop())
}
}
public abstract class RegionComponentBase : MonoBehaviour
{
public abstract void Init();
public abstract void Loop();
}
RegionComponentBase
holds data and logics for RegionObj
. So there are many classes inheriting this.
Problem:
I want make Action
s that manupulates RegionObj
, would it be Ok to just take RegionObj
as parameter or field and take references of RegionComponentBase
s to manipulate?. Or should I make an another interface(or maybe class) like IRegionManipulator
which have methods for Action
to use?
Thanks for reading my question!