Castle Game Engine: CastleItems: Class TItemWeaponResource

# Class TItemWeaponResource
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleItems ## Declaration `type TItemWeaponResource = class(TItemResource)` ## Description Weapon that can make an immiediate attack (short-range/shoot) or fire a missile. ## Hierarchy TObject T3DResource TItemResource TItemWeaponResource ## Overview ### Fields
| `internal const DefaultAttackTime = 0.0;`
| `internal const DefaultAttackDamageConst = 0.0;`
| `internal const DefaultAttackDamageRandom = 0.0;`
| `internal const DefaultAttackKnockbackDistance = 0.0;`
| `internal const DefaultAttackShoot = false;`
### Methods
| `function ItemClass: TInventoryItemClass; override;`
| `constructor Create(const AName: string); override;`
| `procedure LoadFromFile(ResourceConfig: TCastleConfig); override;`
### Properties
| `property EquippingSound: TSoundType read FEquippingSound write FEquippingSound;`
| `property AttackAnimation: T3DResourceAnimation read FAttackAnimation;`
| `property ReadyAnimation: T3DResourceAnimation read FReadyAnimation;`
| `property AttackTime: Single read FAttackTime write FAttackTime default DefaultAttackTime;`
| `property AttackSoundStart: TSoundType read FAttackSoundStart write FAttackSoundStart default stNone;`
| `property AttackAmmo: string read FAttackAmmo write FAttackAmmo;`
| `property AttackDamageConst: Single read FAttackDamageConst write FAttackDamageConst default DefaultAttackDamageConst;`
| `property AttackDamageRandom: Single read FAttackDamageRandom write FAttackDamageRandom default DefaultAttackDamageRandom;`
| `property AttackKnockbackDistance: Single read FAttackKnockbackDistance write FAttackKnockbackDistance default DefaultAttackKnockbackDistance;`
| `property AttackShoot: boolean read FAttackShoot write FAttackShoot default DefaultAttackShoot;`
| `property AttackSoundHit: TSoundType read FAttackSoundHit write FAttackSoundHit;`
| `property FireMissileName: string read FFireMissileName write FFireMissileName;`
| `property FireMissileSound: TSoundType read FFireMissileSound write FFireMissileSound default stNone;`
## Description ### Fields
| `internal const DefaultAttackTime = 0.0;`
| `internal const DefaultAttackDamageConst = 0.0;`
| `internal const DefaultAttackDamageRandom = 0.0;`
| `internal const DefaultAttackKnockbackDistance = 0.0;`
| `internal const DefaultAttackShoot = false;`
### Methods
| `function ItemClass: TInventoryItemClass; override;`
| `constructor Create(const AName: string); override;`
| `procedure LoadFromFile(ResourceConfig: TCastleConfig); override;`
### Properties
| `property EquippingSound: TSoundType read FEquippingSound write FEquippingSound;`
Sound to make on equipping. Each weapon can have it's own equipping sound.
| `property AttackAnimation: T3DResourceAnimation read FAttackAnimation;`
Animation of attack with this weapon.
| `property ReadyAnimation: T3DResourceAnimation read FReadyAnimation;`
Animation of keeping weapon ready.
| `property AttackTime: Single read FAttackTime write FAttackTime default DefaultAttackTime;`
A time within AttackAnimationat at which TItemWeapon.Attack method will be called, which actually hits the enemy.
| `property AttackSoundStart: TSoundType read FAttackSoundStart write FAttackSoundStart default stNone;`
Sound when attack starts. This is played when attack animation starts, and it means that we already checked that you have necessary ammunition (see AttackAmmo).
| `property AttackAmmo: string read FAttackAmmo write FAttackAmmo;`
Ammunition required to make an attack (applies to both immediate attack, like short-range/shoot, and firing missiles). Indicates item resource name to use as ammunition (like 'Quiver' or 'Bullets'). It may be empty, in which case the ammunition is not necessary to make an attack. If it's set, we will check whether owner of the weapon (like a player) has at least one item of this resource, and we'll decrease it when firing. For example, if this weapon is a pistol, then you can set AttackDamageConst and AttackDamageRandom to non-zero and AttackShoot to `True` to perform an immediatele shooting attack. And set `AttackAmmo` to something like 'Bullets'. For example, if this weapon is a bow, then you can set FireMissileName to 'Arrow', to fire arrows as missiles (they will fly and can be avoided by fast moving enemies). And set `AttackAmmo` to something like 'Quiver'.
| `property AttackDamageConst: Single read FAttackDamageConst write FAttackDamageConst default DefaultAttackDamageConst;`
Immediate attack (short-range/shoot) damage and knockback. This type of attack (along with AttackSoundHit) is only done if one of these properties is non-zero. They must be >= 0.
| `property AttackDamageRandom: Single read FAttackDamageRandom write FAttackDamageRandom default DefaultAttackDamageRandom;`
| `property AttackKnockbackDistance: Single read FAttackKnockbackDistance write FAttackKnockbackDistance default DefaultAttackKnockbackDistance;`
| `property AttackShoot: boolean read FAttackShoot write FAttackShoot default DefaultAttackShoot;`
Does the immediate attack is shooting. Shooting means that the hit enemy is determined by casting a ray from owner (like a shooting player) and seeing what it hits. Even enemies far away may be hit, but you have to aim precisely. When this is `False`, we make a short-range (melee) attack. In this case the hit enemy is determined by looking at the weapon bounding volume near owner. Only the enemies very close to the owner get hit.
| `property AttackSoundHit: TSoundType read FAttackSoundHit write FAttackSoundHit;`
Sound on successfull hit by an immediate attack (short-range/shoot).
| `property FireMissileName: string read FFireMissileName write FFireMissileName;`
Creature resource name to be created (like 'Arrow') when firing a missile. Must be set to something not empty to actually fire a missile.
| `property FireMissileSound: TSoundType read FFireMissileSound write FFireMissileSound default stNone;`
Sound on missile fired.
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:10