ALimenBattery
Overview
ALimenBattery is an actor derived from ALimenDiscardableItem. It manages a battery's capacity, allowing it to be drained and checked for emptiness. The class overrides several lifecycle events and provides methods to interact with the battery's state.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| Capacity | Private | Pointer to the battery capacity attribute. |
Functions
Return Type | Signature | Description |
|---|---|---|
|
| Called when the actor is being constructed. Initializes the battery capacity. |
|
| Called when the game starts or when spawned. Does nothing in this implementation. |
|
| Determines if data should be loaded for this item. Returns true, overriding the base class behavior. |
|
| Determines if data should be saved for this item. Returns true, overriding the base class behavior. |
|
| Checks if the battery is empty. Returns true if the capacity is zero. |
|
| Gets the current percentage of the battery's capacity. Returns 0 if the capacity pointer is null. |
|
| Drains the battery by a specified value, ensuring it does not go below zero. |
|
| Gets the current battery capacity attribute. |
Usage & Implementation Notes
Threading Constraints: None.
Replication Requirements: None.
Memory Lifetime Management: The
Capacityproperty is managed by Unreal Engine's garbage collection system.Initialization Dependencies: The
Capacityattribute must be initialized in the constructor to ensure it is not null.