SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
AlarmableManager Class Reference

Manages the registration and processing of alarms for GameObjects. More...

#include <AlarmableManager.h>

Public Types

enum class  ALARM_ID { ALARM_0 , ALARM_1 , ALARM_2 }
 Enum class representing the alarm IDs.
 
using StorageMapRef = TimeLineMap::iterator
 Type alias for the storage map iterator.
 

Public Member Functions

 AlarmableManager (const AlarmableManager &)=delete
 
AlarmableManageroperator= (const AlarmableManager &)=delete
 
void Register (Alarmable *al, ALARM_ID id, float t)
 Registers an alarm for a GameObject.
 
void Deregister (Alarmable *al, ALARM_ID id)
 Deregisters an alarm for a GameObject.
 
void ProcessAlarms ()
 Processes all alarms; triggers and removes expired alarms.
 

Static Public Attributes

static const int ALARM_NUMBER = 3
 The number of alarms.
 

Private Types

using AlarmEvent = std::pair<Alarmable*, ALARM_ID>
 Type alias for the alarm event pair.
 
using TimeLineMap = std::multimap<float, AlarmEvent>
 Type alias for the timeline map of alarms.
 

Private Attributes

TimeLineMap timeline
 The timeline map of alarms.
 

Detailed Description

Manages the registration and processing of alarms for GameObjects.

The AlarmableManager class is responsible for managing the registration and processing of alarms for GameObjects. It provides methods to register, deregister, and process alarms.

Member Function Documentation

◆ Deregister()

void AlarmableManager::Deregister ( Alarmable * al,
ALARM_ID id )

Deregisters an alarm for a GameObject.

Parameters
alPointer to the GameObject.
idThe alarm ID to deregister.
Here is the call graph for this function:

◆ Register()

void AlarmableManager::Register ( Alarmable * al,
ALARM_ID id,
float t )

Registers an alarm for a GameObject.

Parameters
alPointer to the GameObject.
idThe alarm ID to register.
tThe time duration for the alarm.
Here is the call graph for this function:

The documentation for this class was generated from the following files: