I am doing test task where I should make prototype of game in "x in a row"-genre. Almost all logic is done, but left one more thing that I can't get.
In the task description I should merge three elements (for example of type A) in some rules and they transforms into new element( for example - B).
My best idea for now is add a method to interface IGameplayObject (all gameplay objects implement this interface) method CanBeMergedTo() with the next signature:
bool CanBeMergedTo(IGameplayObject obj) {}
or
enum MergeType{...}
bool CanBeMergedTo(MergeType mt) {}
But in both realisations I must for each new gameplay object implement this merge behaviour, and in case project will growing it may become annoying..
Can you give me some advices?
Maybe threr is some pattern i should search for? Or there is a default (or common) way to do that?
Aucun commentaire:
Enregistrer un commentaire