Passives C++ API
UBasePassive
Class: UBasePassive — Source/LesDeuxPelos/Public/Passives/BasePassive.h
Inherits: UActorComponent
Overview
A passive is a component attached to a character that fires automatically on a cooldown timer.
It spawns projectiles via Shoot() and supports 5 upgrade levels.
Enum: EPassiveTargetOverride
| Value | Description |
|---|---|
OwnerTargetChain | Uses the character's targeting logic (default). |
ClosestEnemy | Targets the nearest enemy regardless of character logic. |
ClosestAlly | Targets the nearest ally. |
StraightAhead | Fires in the owner's forward direction. |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
Level | int | 0 | Current upgrade level. Starts at 1 after first UpgradePassive() call. Read-only. |
Cooldown | TArray<float> | — | Fire rate in seconds, one entry per level (5 total). |
ProjectileBP | TArray<TSubclassOf<ABaseProjectile>> | — | Projectile Blueprint class per level. |
IsTankPassive | bool | — | true = equipped on the tank character. |
bIsParentedToOwner | bool | false | Attach spawned projectiles to the owner actor. |
TargetOverride | EPassiveTargetOverride | OwnerTargetChain | Targeting logic override. |
CooldownWithStats | float | 0.1 | Effective cooldown after stat modifiers. Updated at runtime. |
Methods
| Method | Access | Description |
|---|---|---|
UpgradePassive() | protected BlueprintCallable | Increases level by 1 (max 5). Restarts the timer with the new cooldown. Returns true on success. |
Shoot() | protected virtual | Called by the timer. Override in C++ or let Blueprint subclasses use ProjectileBP. |
StartTimer() | protected | Initialises the ShootTimerHandle. Called at BeginPlay. |
UBaseAoE
Class: UBaseAoE — Source/LesDeuxPelos/Public/Passives/BaseAoE.h
Inherits: UBasePassive
Overview
An AoE passive that places an indicator mesh at the target location, waits, then damages all actors in the radius.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
AoEIndicatorMesh | UStaticMesh* | — | Mesh shown during the pre-damage delay. |
AoEIndicatorMaterial | UMaterialInterface* | — | Material for the indicator. |
DamageAmount | int | 30 | Flat damage applied to all actors in range. |
AttackRange | float | 500 | AoE radius in Unreal units. |
TimeToPop | float | 1.0 | Delay (seconds) between indicator spawn and damage. |
MakesCasterStop | bool | true | Stops caster movement while the AoE is active. |
Methods
| Method | Access | Description |
|---|---|---|
Shoot() | public virtual override | Places the indicator and starts the TimeToPop timer. |
ActivateAoE() | public | Called after TimeToPop — triggers ApplyDamageToActorsInAoE() and cleanup. |
ApplyDamageToActorsInAoE() | protected | Sphere overlap at CurrentAoELocation with AttackRange, applies DamageAmount. |
Blueprint usage
- Create a Passive → Create a Passive