Nocturna
    Preparing search index...

    EditorScene provides the in-game level editor for Nocturna.

    Allows users to create, modify, and test custom levels in a 3D environment. Handles adding, selecting, moving, rotating, resizing, cloning, and deleting objects. Uses Babylon.js for rendering, picking, camera control, and asset management. Integrates a HUD for editor controls and mode display. Manages editor states (Addition, Move, Rotation, Resize, Selection) via a state machine. Plays sound feedback for editor actions (select, drop, delete, save, etc.). Supports serialization/export of the current level to a JSON file.

    Implements:

    • LevelLoaderObserver: callbacks when the level/cube/parent/player are loaded.
    • IHUDEditorListener: callbacks for HUD actions (mode, cancel, remove, clone).

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    engine: Engine

    The Babylon.js engine instance.

    inputHandler: InputHandler

    Handles user input for the scene.

    scene: Scene

    The Babylon.js scene instance.

    Methods

    • Initializes Havok physics for the scene with high gravity and a fixed timestep. Should be called asynchronously.

      Returns Promise<void>

    • Loads a level from a file or JSON string.

      Parameters

      • level: string

        The level to load.

      Returns void

    • Plays a sound for editor actions.

      Parameters

      • name: string

        Name of the sound to play.

      Returns void

    • Serializes the current scene and triggers a JSON download.

      Returns void

    • Enables multi-mode setup for the editor (prepares the cube for multiplayer).

      Returns void

    • Sets up the mouse click listener for object selection.

      Returns void