Class TItemWeapon

Unit

Declaration

type TItemWeapon = class(TInventoryItem)

Description

No description available, ancestor TInventoryItem description follows

An item that can be used, kept in the inventory, or (using PutOnWorld that wraps it in TItemOnWorld) dropped on 3D world. Thanks to the Quantity property, this may actually represent many "stacked" items, all having the same properties.

Hierarchy

Overview

Nested Types

Published TWeaponState = (...);

Methods

Protected procedure Attack(const Level: TAbstractLevel); virtual;
Protected procedure Use; override;
Protected procedure ReloadNow; virtual;
Public function Resource: TItemWeaponResource;
Public procedure Equip; virtual;
Public procedure EquippedAttack(const Level: TAbstractLevel); virtual;
Public procedure EquippedUpdate(const Level: TAbstractLevel; const SecondsPassed: Single; const ResourceFrame: TResourceFrame); virtual;
Public procedure EquippedReload(const IgnorePreviousState: Boolean);

Properties

Public property AmmoLoaded: Cardinal read FAmmoLoaded write FAmmoLoaded;

Description

Nested Types

Published TWeaponState = (...);
 
Values
  • wsReady
  • wsAttack
  • wsReload

Methods

Protected procedure Attack(const Level: TAbstractLevel); virtual;

Make real attack, immediate (short-range/shoot) or firing missile. Called during weapon TItemWeaponResource.AttackAnimation, at the time TItemWeaponResource.AttackTime. The default implementation in TItemWeapon does a short-range/shoot attack (if AttackDamageConst or AttackDamageRandom or AttackKnockbackDistance non-zero) and fires a missile (if FireMissileName not empty).

Protected procedure Use; override;
 
Protected procedure ReloadNow; virtual;

Make actual reload that refills AmmoLoaded.

Public function Resource: TItemWeaponResource;
 
Public procedure Equip; virtual;

Owner equips this weapon.

Public procedure EquippedAttack(const Level: TAbstractLevel); virtual;

Owner starts attack with this equipped weapon.

Public procedure EquippedUpdate(const Level: TAbstractLevel; const SecondsPassed: Single; const ResourceFrame: TResourceFrame); virtual;

Time passses for equipped weapon.

Public procedure EquippedReload(const IgnorePreviousState: Boolean);

Initiate reload of the equipped weapon (run "reload" animation, refill AmmoLoaded). If IgnorePreviousState then it works unconditionally, otherwise it works only when the current state is not in the middle of shooting/reloading.

Properties

Public property AmmoLoaded: Cardinal read FAmmoLoaded write FAmmoLoaded;

Currently loaded capacity in the magazine.


Generated by PasDoc 0.16.0.