Skip to content

Commit e749447

Browse files
committed
Added 'BatteryPickup' power
1 parent cb3007c commit e749447

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Source/BatteryCollector/BatteryPickup.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
ABatteryPickup::ABatteryPickup()
99
{
1010
GetMesh()->SetSimulatePhysics(true);
11+
12+
//the base power level of the battery
13+
BatteryPower = 150.f;
1114
}
1215

1316

@@ -18,3 +21,9 @@ void ABatteryPickup::WasCollected_Implementation()
1821
// Destroy the battery
1922
Destroy();
2023
}
24+
25+
// report the power level of the battery
26+
float ABatteryPickup::GetPower()
27+
{
28+
return BatteryPower;
29+
}

Source/BatteryCollector/BatteryPickup.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,13 @@ class BATTERYCOLLECTOR_API ABatteryPickup : public APickup
1919

2020
/** Override the WasCollected function - use Implementation because it's a Blueprint Native Event */
2121
void WasCollected_Implementation() override;
22+
23+
/**Public way to access the battery's power level */
24+
float GetPower();
25+
26+
protected:
27+
/**Set the amount of power the battery gives to the character */
28+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Power", Meta = (BlueprintProtected = "true"))
29+
float BatteryPower;
30+
2231
};

0 commit comments

Comments
 (0)