Castle Game Engine: CastleLevels: Class TLevelLogic

# Class TLevelLogic
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleLevels ## Declaration `type TLevelLogic = class(T3D)` ## Description Level logic. We use T3D descendant, since this is the comfortable way to add any behavior to the 3D world (it doesn't matter that "level logic" is not a usual 3D object — it doesn't have to collide or be visible). ## Hierarchy TComponent T3D TLevelLogic ## Overview ### Methods
| `constructor Create(AOwner: TComponent; AWorld: T3DWorld; MainScene: TCastleScene; DOMElement: TDOMElement); reintroduce; virtual;`
| `function BoundingBox: TBox3D; override;`
| `function World: T3DWorld; override;`
| `procedure PrepareNewPlayer(NewPlayer: TPlayer); virtual;`
| `procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;`
### Properties
| `property Time: TFloatTime read FTime;`
## Description ### Methods
| `constructor Create(AOwner: TComponent; AWorld: T3DWorld; MainScene: TCastleScene; DOMElement: TDOMElement); reintroduce; virtual;`
  Create new level instance. Called before resources (creatures and items) are initialized (override PlaceholdersEnd if you need to do something after creatures and items are added). You can modify MainScene contents here. ###### Parameters AWorld 3D world items. We provide AWorld instance at construction, and the created TLevelLogic instance will be added to this AWorld, and you cannot change it later. This is necessary, as TLevelLogic descendants at construction may actually modify your world, and depend on it later. DOMElement An XML tree of level.xml file. You can read it however you want, to handle additional attributes in level.xml. You can use standard FPC DOM unit and classes, and add a handful of simple comfortable routines in CastleXMLUtils unit, for example you can use this to read a boolean attribute "my_attribute":
        if not DOMGetBooleanAttribute(DOMElement, 'my_attribute', MyAttribute) then
          MyAttribute := false; // default value, if not specified in level.xml
| `function BoundingBox: TBox3D; override;`
| `function World: T3DWorld; override;`
| `procedure PrepareNewPlayer(NewPlayer: TPlayer); virtual;`
Called when new player starts new game on this level. This may be used to equip the player with some basic weapon / items. This is never called or used by the engine itself. This does nothing in the default TLevelLogic class implementation. Your particular game, where you can best decide when the player "starts a new game" and when the player merely "continues the previous game", may call it. And you may override this in your TLevelLogic descendants to equip the player.
| `procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;`
### Properties
| `property Time: TFloatTime read FTime;`
Time of the level, in seconds. Time 0 when level is created. This is updated in our Update.
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:13