SceneInterface

Namespace:

namespace Lenga\Engine\Interfaces;

Marker interface for Lenga scene objects. All scenes implement this interface, allowing engine systems and scripts to reference scenes generically without coupling to the concrete Scene class.

In most scripts you will work with SceneManager to load and query scenes rather than implementing this interface yourself.

Example

use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Interfaces\SceneInterface;
use Lenga\Engine\SceneManagement\SceneManager;

class SceneDebugger extends Behaviour
{
    public function start(): void
    {
        $scene = SceneManager::getActiveScene();

        if ($scene instanceof SceneInterface) {
            // work with the scene generically
        }
    }
}