Castle Game Engine: CastleCreatures: Class TCreature

# Class TCreature
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleCreatures ## Declaration `type TCreature = class(T3DAlive)` ## Description Base creature, using any TCreatureResource. ## Hierarchy TComponent T3D T3DList T3DCustomTransform T3DOrient T3DAlive TCreature ## Overview ### Methods
| `procedure SetLife(const Value: Single); override;`
| `procedure Fall(const FallHeight: Single); override;`
| `function LerpLegsMiddle(const A: Single): TVector3Single;`
| `procedure AttackHurt(const HurtEnemy: T3DAlive);`
| `function DebugCaption: TCastleStringList; virtual;`
| `constructor Create(AOwner: TComponent; const AMaxLife: Single); virtual; reintroduce;`
| `destructor Destroy; override;`
| `function GetExists: boolean; override;`
| `procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;`
| `procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;`
| `procedure Sound3d(const SoundType: TSoundType; const SoundHeight: Single; TiedToCreature: boolean = true);`
| `function Sphere(out Radius: Single): boolean; override;`
### Properties
| `property Resource: TCreatureResource read FResource;`
| `property SoundDieEnabled: boolean read FSoundDieEnabled write FSoundDieEnabled default true;`
| `property CollidesWithMoving default true;`
## Description ### Methods
| `procedure SetLife(const Value: Single); override;`
| `procedure Fall(const FallHeight: Single); override;`
| `function LerpLegsMiddle(const A: Single): TVector3Single;`
`LerpLegsMiddle` interpolates between Position and Middle (intuitively, legs and eye positions).
| `procedure AttackHurt(const HurtEnemy: T3DAlive);`
Hurt given enemy. HurtEnemy may be `Nil`, in this case we do nothing.
| `function DebugCaption: TCastleStringList; virtual;`
| `constructor Create(AOwner: TComponent; const AMaxLife: Single); virtual; reintroduce;`
| `destructor Destroy; override;`
| `function GetExists: boolean; override;`
| `procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;`
| `procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;`
| `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.
| `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
| `property Resource: TCreatureResource read FResource;`
| `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.
| `property CollidesWithMoving default true;`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:09