bijington / orbit

The Orbit engine is a game engine built on top of .NET MAUI Graphics. The objective is to firstly enjoy the journey of building a game engine and secondly providing a framework that allows us to utilise the best parts of a cross-platform framework while building a 'typical' game.
289 stars 37 forks source link

Investigate and add in better lifecycle support for game entities #13

Open bijington opened 2 years ago

bijington commented 2 years ago

Consider letting GameScene and GameObject know when child objects are added/removed. Also allow for objects to know when they have been added/removed.

And finally GameScene should know when it is loaded/unloaded.

Something like:

public class GameScene
{
    public void OnGameObjectAdded(IGameObject gameObject);

    public void OnGameObjectRemoved(IGameObject gameObject);

    public void OnLoaded();

    public void OnUnloaded();
}
public class GameObject
{
    public void OnGameObjectAdded(IGameObject gameObject);

    public void OnGameObjectRemoved(IGameObject gameObject);

    public void OnAdded(); // TODO: Parent?

    public void OnRemoved();
}