Class TLevelLogic
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
Properties
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;
|
 |
function BoundingBox: TBox3D; 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 Idle(const CompSpeed: 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 Idle.
|
Generated by PasDoc 0.12.1 on 2013-02-04 20:26:51
|