ULimenTimerComponent
Overview
ULimenTimerComponent is an actor component designed to manage a timer. It allows starting, stopping, and resetting the timer, and provides events when the timer starts or stops. The component is replicated across the network, ensuring that all clients have consistent state.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| OnStart | Public | A delegate event triggered when the timer starts. |
| OnStop | Public | A delegate event triggered when the timer stops. |
| Start | Private | The start time of the timer, replicated across the network. |
| End | Private | The end time of the timer, replicated across the network. |
Functions
Return Type | Signature | Description |
|---|---|---|
| ResetTimer() | Resets the timer to an invalid state and marks properties as dirty for replication. |
| StartTimer() | Starts the timer by setting the start time to the current date and time, resets the end time, and broadcasts the OnStart event. |
| StopTimer() | Stops the timer by setting the end time to the current date and time, marks properties as dirty for replication, and broadcasts the OnStop event. |
| GetCurrentTime() const | Returns the elapsed time since the timer started or zero if the timer is not active. |
| GetStartTime() const | Returns the start time of the timer. |
| IsTimerActive() const | Checks if the timer is currently active (i.e., started but not stopped). |
Usage & Implementation Notes
The component must be used on an actor that has authority to ensure correct replication and functionality.
The timer's state is replicated using Unreal Engine's network replication system, ensuring consistency across clients.
The
OnRep_StartandOnRep_Endfunctions handle the replication of the start and end times, broadcasting events when these properties change.