Class TLevel
Unit
Declaration
type TLevel = class(TAbstractLevel)
Description
Manage (load and unload) game level.
For basic usage, assign Viewport and call Load. It is similar to creating regular TCastleScene and adding it to Viewport.Items
, but has some extra features. Most notably, it will instantiate also creatures and items looking at special "placeholders" in the model file.
Hierarchy
- TObject
- TPersistent
- TComponent
- TAbstractLevel
- TLevel
Overview
Methods
![]() |
procedure Notification(AComponent: TComponent; Operation: TOperation); override; |
![]() |
constructor Create(AOwner: TComponent); override; |
![]() |
destructor Destroy; override; |
![]() |
function GetPlayer: TCastleTransform; override; |
![]() |
function GetSectors: TSectorList; override; |
![]() |
function RootTransform: TCastleRootTransform; override; |
![]() |
function PrepareParams: TPrepareParams; override; |
![]() |
function FreeAtUnload: TComponent; override; |
![]() |
procedure Load(const LevelName: string); |
![]() |
procedure Load(const AInfo: TLevelInfo); |
![]() |
procedure Unload; |
Properties
![]() |
property Viewport: TCastleViewport read FViewport write FViewport; |
![]() |
property Logic: TLevelLogic read FLogic; |
![]() |
property Info: TLevelInfo read FInfo; |
![]() |
property Sectors: TSectorList read FSectors; |
![]() |
property Water: TBox3D read FWater write FWater; |
![]() |
property Player: TPlayer read FPlayer write SetPlayer; |
Description
Methods
![]() |
procedure Notification(AComponent: TComponent; Operation: TOperation); override; |
![]() |
constructor Create(AOwner: TComponent); override; |
![]() |
destructor Destroy; override; |
![]() |
function GetPlayer: TCastleTransform; override; |
![]() |
function GetSectors: TSectorList; override; |
![]() |
function RootTransform: TCastleRootTransform; override; |
![]() |
function PrepareParams: TPrepareParams; override; |
![]() |
function FreeAtUnload: TComponent; override; |
![]() |
procedure Load(const LevelName: string); |
Load game level.
The overloaded version with a LevelName string searches the Levels list for a level with given name (and raises exception if it cannot be found). It makes sense if you filled the Levels list before, usually by Levels.LoadFromFiles call. So you can easily define a level in your data with It's important to note that you do not have to use this method to make a 3D game. You may as well just load the 3D scene yourself, and add things to TCastleViewport.Items and TCastleRootTransform.MainScene directly. This method is just a comfortable way to set a world, with creatures and items, using placeholders. |
![]() |
procedure Load(const AInfo: TLevelInfo); |
![]() |
procedure Unload; |
Release everything loaded by Load, clearing the 3D world. You do not have to call this in normal circumstances, as each Load automatically clears previous 3D world. If fact, you should not call this in normal circumstances: calling this prevents the next Load to reuse resources that were needed by both old and new level. Call this only if you really want to conserve memory right now. Or when you want to force reload of resources at next Load call (for example, if you changed BakedAnimationSmoothness, it is useful — otherwise the old animations will remain loaded with old BakedAnimationSmoothness setting). |
Properties
![]() |
property Viewport: TCastleViewport read FViewport write FViewport; |
|
![]() |
property Logic: TLevelLogic read FLogic; |
Level logic and state. |
![]() |
property Info: TLevelInfo read FInfo; |
Level information, independent from current level state. |
![]() |
property Sectors: TSectorList read FSectors; |
Sectors and waypoints of this world, for AI in 3D. Initialized by Load. |
![]() |
property Water: TBox3D read FWater write FWater; |
Water volume in the scene. It may be used by various 3D objects to indicate appropriate behavior — some things swim, some things drown and such. For now, this is only used by TPlayer class to detect swimming (and make appropriate sounds, special rendering, drowning and such). For now, this is just a simple TBox3D. It will be extended to represent a set of flexible 3D volumes in the future. Empty initially. Initialize it however you want. |
![]() |
property Player: TPlayer read FPlayer write SetPlayer; |
Player in this 3D world. This serves various purposes:
|
Generated by PasDoc 0.16.0.