mardi 3 janvier 2017

What design pattern is it, What's the pros and cons of it?

So basically when I was reading through some free assets written by others. I found this class called _StateBase and i can't help wondering what design pattern they used. (If there's any) Shown below.

public abstract class _StatesBase : MonoBehaviour
{
    public abstract void OnActivate();
    public abstract void OnDeactivate();
    public abstract void OnUpdate();
    public override string ToString()
    {
        return this.GetType().ToString();
    }
}

And also, besides this class, I also see a bunch of classes named, GameoverState, GamePlayState, GoalState. All inheriting the _StateBase class.

Managers.Game.SetState(typeof(MenuState));

Any suggestions would be appreciated.

Aucun commentaire:

Enregistrer un commentaire