Class TWalkAttackCreature

Unit

Declaration

type TWalkAttackCreature = class(TCreature)

Description

Creature using TWalkAttackCreatureResource.

Hierarchy

Overview

Fields

Protected HasLastSensedEnemy: boolean;
Protected LastSensedEnemy: TVector3;
Protected LastSensedEnemySector: TSector;

Methods

Protected procedure SetState(Value: TCreatureState); virtual;
Protected procedure SetLife(const Value: Single); override;
Protected procedure UpdateDebugCaption(const Lines: TCastleStringList); override;
Protected function Enemy: TAlive; virtual;
Protected procedure Attack; virtual;
Protected procedure FireMissile; virtual;
Public constructor Create(AOwner: TComponent; const AMaxLife: Single); override;
Public destructor Destroy; override;
Public function Resource: TWalkAttackCreatureResource;
Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
Public procedure Hurt(const LifeLoss: Single; const HurtDirection: TVector3; const AKnockbackDistance: Single; const Attacker: TAlive); override;

Properties

Protected property StateChangeTime: Single read FStateChangeTime;
Public property State: TCreatureState read FState default csIdle;

Description

Fields

Protected HasLastSensedEnemy: boolean;

Last known information about enemy.

Protected LastSensedEnemy: TVector3;
 
Protected LastSensedEnemySector: TSector;
 

Methods

Protected procedure SetState(Value: TCreatureState); virtual;
 
Protected procedure SetLife(const Value: Single); override;
 
Protected procedure UpdateDebugCaption(const Lines: TCastleStringList); override;
 
Protected function Enemy: TAlive; 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.

Protected 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.

Protected 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.

Public constructor Create(AOwner: TComponent; const AMaxLife: Single); override;
 
Public destructor Destroy; override;
 
Public function Resource: TWalkAttackCreatureResource;
 
Public procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;
 
Public procedure Hurt(const LifeLoss: Single; const HurtDirection: TVector3; const AKnockbackDistance: Single; const Attacker: TAlive); override;
 

Properties

Protected property StateChangeTime: Single read FStateChangeTime;

Last State change time, taken from LifeTime.

Public property State: TCreatureState read FState default csIdle;
 

Generated by PasDoc 0.15.0.