A virtual derived class of GameObject that allows the GameObject to set alarms. More...

#include <Alarmable.h>

Inheritance diagram for Alarmable:

Detailed Description

A virtual derived class of GameObject that allows the GameObject to set alarms.

A class that inherits from Alarmable gains access to the Alarm functions. These allow the user to execute code after a set delay. Each alarmable derived class can have up to three defined alarms: Alarm0(), Alarm1(), and Alarm2().

Protected Member Functions

void SetAlarm (const float &seconds, const AlarmID &aID)
 Function to register when a specified alarm is to be triggered. More...
 
void StopAlarm (const AlarmID &aID)
 Function to deregister specified alarm from being triggered. More...
 
virtual void Alarm0 ()
 Function which is called if set by the user. More...
 
virtual void Alarm1 ()
 Function which is called if set by the user. More...
 
virtual void Alarm2 ()
 Function which is called if set by the user. More...
 
- Protected Member Functions inherited from GameObject
virtual void SceneEntry ()=0
 Function which is called upon a registered scene entry. More...
 
virtual void SceneExit ()=0
 Function which is called upon a registered scene exit. More...
 

Additional Inherited Members

- Public Member Functions inherited from GameObject
void SubmitEntry ()
 Public Function to register a call for the GameObject's SceneEntry() function. More...
 
void SubmitExit ()
 Public Function to register a call for the GameObject's SceneEntry() function. More...
 

Member Function Documentation

virtual void Alarmable::Alarm0 ( )
inlineprotectedvirtual

Function which is called if set by the user.

This is a virtual function to be overriden by the user. If the specified alarm is set, the Alarm() function will be called by the AlarmableManager after the set time runs out. The alarm can be set by using the SetAlarm() and StopAlarm() functions.

virtual void Alarmable::Alarm1 ( )
inlineprotectedvirtual

Function which is called if set by the user.

This is a virtual function to be overriden by the user. If the specified alarm is set, the Alarm() function will be called by the AlarmableManager after the set time runs out. The alarm can be set by using the SetAlarm() and StopAlarm() functions.

virtual void Alarmable::Alarm2 ( )
inlineprotectedvirtual

Function which is called if set by the user.

This is a virtual function to be overriden by the user. If the specified alarm is set, the Alarm() function will be called by the AlarmableManager after the set time runs out. The alarm can be set by using the SetAlarm() and StopAlarm() functions.

void Alarmable::SetAlarm ( const float &  seconds,
const AlarmID &  aID 
)
protected

Function to register when a specified alarm is to be triggered.

When the SetAlarm() function is called, a float for number of seconds and an AlarmID reference is passed. The seconds parameter determines how many seconds from the current time that the alarm function be called. The aID parameter specifies which alarm function should be called. The AlarmID enum is mapped to the alarm functions like so:

Parameters
secondsThe number of seconds the alarm is to be set for (starting at the current time).
aIDThe ID to specify which alarm to set.
void Alarmable::StopAlarm ( const AlarmID &  aID)
protected

Function to deregister specified alarm from being triggered.

The StopAlarm() function will end the countdown ofa specified function, thus stopping the alarm function from being triggered if it is currently registered. The aID parameter specifies which alarm function should be called. The AlarmID enum is mapped to the alarm functions like so:

Parameters
aIDThe ID to specify which alarm to stop.