Class TCreature

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TCreature = class(T3DAlive)

Description

Base creature, using any TCreatureResource.

Hierarchy

Overview

Methods

Public constructor Create(AOwner: TComponent; const AMaxLife: Single); virtual; reintroduce;
Public destructor Destroy; override;
Public procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;
Public procedure Idle(const CompSpeed: Single; var RemoveMe: TRemoveType); override;
Public procedure Sound3d(const SoundType: TSoundType; const SoundHeight: Single; TiedToCreature: boolean = true);
Public function Sphere(out Radius: Single): boolean; override;

Properties

Public property Resource: TCreatureResource read FResource;
Public property SoundDieEnabled: boolean read FSoundDieEnabled write FSoundDieEnabled default true;
Public property CollidesWithMoving default true;

Description

Methods

Public constructor Create(AOwner: TComponent; const AMaxLife: Single); virtual; reintroduce;
 
Public destructor Destroy; override;
 
Public procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;
 
Public procedure Idle(const CompSpeed: Single; var RemoveMe: TRemoveType); override;
 
Public procedure Sound3d(const SoundType: TSoundType; const SoundHeight: Single; TiedToCreature: boolean = true);

Play SoundType where the creature's position is.

Exactly, the position is between Position and Middle — SoundHeight = 0 means Position, SoundHeight = 1 means Middle, SoundHeight between means ... well, between Position and Middle. This can also be higher than 1 or lower than 0, should be treated like lerp between Position and Middle.

If TiedToCreature then the sounds position will be updated as the creature will move, and when the creature object will be destroyed, sound will stop. If not TiedToCreature, then the sound will simply be done at creature's position, but then it will continue to be played independent of this creature.

Public function Sphere(out Radius: Single): boolean; override;

Can the approximate sphere be used for some collision-detection tasks.

Set to False in descendants if Resource.Radius is not appropriate for this creature state.

In this class, this is implemented to return not Dead. This is usually sensible, since only alive creatures need bounding sphere advantages (stairs climbing), and using sphere with dead creatures would unnecessarily force the sphere radius to be small and Middle to be high.

Properties

Public property Resource: TCreatureResource read FResource;
 
Public property SoundDieEnabled: boolean read FSoundDieEnabled write FSoundDieEnabled default true;

You can set this to False to force the creature to die without making any sound. This is really seldom needed, usefull only to avoid a loud shriek noise when you kill many creatures at once. Primarily for use by debug menu "kill all creatures" and similar things.

Public property CollidesWithMoving default true;
 

Generated by PasDoc 0.12.1 on 2013-02-04 20:26:50