Castle Game Engine: CastleCreatures: Class TWalkAttackCreature

# Class TWalkAttackCreature
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleCreatures ## Declaration `type TWalkAttackCreature = class(TCreature)` ## Description Creature using TWalkAttackCreatureResource. ## Hierarchy TComponent T3D T3DList T3DCustomTransform T3DOrient T3DAlive TCreature TWalkAttackCreature ## Overview ### Fields
| `HasLastSensedEnemy: boolean;`
| `LastSensedEnemy: TVector3Single;`
| `LastSensedEnemySector: TSector;`
### Methods
| `procedure SetState(Value: TCreatureState); virtual;`
| `procedure SetLife(const Value: Single); override;`
| `function DebugCaption: TCastleStringList; override;`
| `function Enemy: T3DAlive; virtual;`
| `function GetChild: T3D; override;`
| `procedure Attack; virtual;`
| `procedure FireMissile; virtual;`
| `constructor Create(AOwner: TComponent; const AMaxLife: Single); override;`
| `destructor Destroy; override;`
| `function Resource: TWalkAttackCreatureResource;`
| `procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;`
| `procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;`
| `procedure Hurt(const LifeLoss: Single; const HurtDirection: TVector3Single; const AKnockbackDistance: Single; const Attacker: T3DAlive); override;`
### Properties
| `property StateChangeTime: Single read FStateChangeTime;`
| `property State: TCreatureState read FState default csIdle;`
## Description ### Fields
| `HasLastSensedEnemy: boolean;`
Last known information about enemy.
| `LastSensedEnemy: TVector3Single;`
| `LastSensedEnemySector: TSector;`
### Methods
| `procedure SetState(Value: TCreatureState); virtual;`
| `procedure SetLife(const Value: Single); override;`
| `function DebugCaption: TCastleStringList; override;`
| `function Enemy: T3DAlive; virtual;`
Enemy of this creature. In this class, this always returns global World.Player (if it exists and is still alive). Return `Nil` for no enemy.
| `function GetChild: T3D; override;`
| `procedure Attack; virtual;`
Actually do the `attack` indicated by AttackAnimation and AttackTime and other AttackXxx properties. This happens in the middle of AttackAnimation, at the time see AttackTime. This can happen only if you defined AttackAnimation for this creature. The default implementation here performs a short range `attack`, if enemy is still within reach (AttackMaxDistance; even if it was within reach at the start of csAttack state, the enemy could step back, so we need to check AttackMaxDistance again). The damage and knockback are defined by TCreatureResource.AttackDamageConst, TCreatureResource.AttackDamageRandom, TCreatureResource.AttackKnockbackDistance.
| `procedure FireMissile; virtual;`
Actually do the attack indicated by FireMissileAnimation and FireMissileTime and other FireMissileXxx properties. This happens in the middle of FireMissileAnimation, at the time see FireMissileTime. This can happen only if you defined FireMissileAnimation for this creature. The default implementation here creates a new creature with resource defined by FireMissileName, if FireMissileName is not empty.
| `constructor Create(AOwner: TComponent; const AMaxLife: Single); override;`
| `destructor Destroy; override;`
| `function Resource: TWalkAttackCreatureResource;`
| `procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;`
| `procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;`
| `procedure Hurt(const LifeLoss: Single; const HurtDirection: TVector3Single; const AKnockbackDistance: Single; const Attacker: T3DAlive); override;`
### Properties
| `property StateChangeTime: Single read FStateChangeTime;`
Last State change time, taken from LifeTime.
| `property State: TCreatureState read FState default csIdle;`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:09