Emergency 20 Dokumentation  4.2.0
em5::MainEvent01 Class Reference

EMERGENCY 5 main event 01 "Munich tram accident". More...

#include <MainEvent01.h>

Inheritance diagram for em5::MainEvent01:
em5::MainEvent em5::FreeplayEvent qsf::Object qsf::WeakPtrTarget

Public Member Functions

 MainEvent01 ()
 Default constructor. More...
 
virtual ~MainEvent01 ()
 Destructor. More...
 
virtual bool onStartup () override
 React to startup of the freeplay event. More...
 
virtual void onShutdown () override
 React to shutdown of the freeplay event. More...
 
virtual void onRun () override
 React to state change from (initial) hidden state to running state. More...
 
virtual bool onSuccess (EventResult &eventResult) override
 React to state change from running state to success state. More...
 
virtual bool onFailure (EventResult &eventResult) override
 React to state change from running state to failed state. More...
 
virtual uint32 calculatePointGain (EventResult &eventResult) override
 Calculate the point gain for this event. More...
 
virtual bool addEntityToEvent (qsf::Entity &targetEntity, eventspreadreason::Reason eventSpreadReason, bool newReason) override
 React to adding to an entity to this event, i.e. setting the event ID for the entity. More...
 
virtual void hintCallback (Observer &hintObserver) override
 Handle the activation of a hint observer. More...
 
virtual const qsf::EntitygetFocusEntity () override
 Get an event entity that is currently crucial for this event This is the entity which gets the focus when the player clicks on go to event. More...
 
virtual void serialize (qsf::BinarySerializer &serializer) override
 Serialization using a binary serializer. More...
 
- Public Member Functions inherited from em5::MainEvent
 MainEvent (const std::string &eraseLayerName, const std::string &settingLayerName, const std::string &eventLayerName, const std::string &introCutsceneLayerName, const std::string &sceneTag, const std::string &introSequence, const std::string &prologueSequence)
 Constructor. More...
 
virtual ~MainEvent ()
 Destructor. More...
 
void onFinishScreenClosed ()
 Gets called when either the win or loose screen has been closed. More...
 
virtual void updateFreeplayEvent (const qsf::Time &timePassed) override
 Regular update call, gets called once a game tick. More...
 
virtual bool checkEventConfiguration () override
 Returns "true" if the event has the right configuration and can trigger right now. More...
 
- Public Member Functions inherited from em5::FreeplayEvent
 FreeplayEvent ()
 Default constructor. More...
 
virtual ~FreeplayEvent ()
 Destructor. More...
 
uint32 getId () const
 Return freeplay event ID. More...
 
const std::string & getEventName () const
 Return freeplay event's localizable name (e.g. "EM5_EVENT_TITLE_04") More...
 
void setEventName (const std::string &name)
 Set freeplay event's localizable name (e.g. "EM5_EVENT_TITLE_04") More...
 
const qsf::NamedIdentifiergetEventFactoryName () const
 Return original freeplay event factory's name. More...
 
void setEventFactoryName (const qsf::NamedIdentifier &factoryName)
 Set original freeplay event factory's name. More...
 
const EntityIdArraygetEntityIds () const
 Get event entities. More...
 
qsf::EntitygetRandomEventEntity () const
 Get a random event entity. More...
 
qsf::EntitygetRandomVisibleEventEntity () const
 
const ObjectiveListgetObjectiveList () const
 Return the objectives list. More...
 
const ObjectiveListgetObjectivesOrResultObjectives () const
 
qsf::MapgetMap ()
 Returns the map this event takes place in, all entities of the event are inside this map. More...
 
const qsf::MapgetMap () const
 
int getObjectivePointByText (const std::string &objectiveText) const
 Return the points the player get if he close this objective. More...
 
int getObjectivePoints () const
 Return the points for all objectives. More...
 
const RecordedHintSystemMessagesgetRecordedHintSystemMessages () const
 Return recorded hint system messages. More...
 
bool startup ()
 Startup the freeplay event. More...
 
void shutdown ()
 Shutdown the freeplay event. More...
 
void setRunning ()
 Set event state to "running", i.e. show the event to the user now. More...
 
void setFinished (bool successful)
 Finish the event, and set it either to succeeded or failed. More...
 
void abortEvent ()
 Abort this event. More...
 
void setCanWinEvent (bool canWinEvent)
 Set the flag which prevents winning the event even though all objectives succeeded. More...
 
bool getCanWinEvent () const
 Access the flag which prevents winning the event even though all objectives succeeded. More...
 
void setCanLoseEvent (bool canLoseEvent)
 Set the flag which prevents losing the event even though a fail condition is fulfilled. More...
 
bool getCanLoseEvent () const
 Access the flag which prevents losing the event even though a fail condition is fulfilled. More...
 
void finishObjective (Objective &objective)
 
void performUpdateFreeplayEvent (const qsf::Time &timePassed)
 Perform regular update once a game tick. More...
 
void pauseEventTime ()
 Pause progress of event time. More...
 
void resumeEventTime ()
 Resume event time after it has been paused. More...
 
qsf::Time getCurrentLifeTime () const
 Get game time passed since this event was triggered, i.e. got its startup. More...
 
qsf::Time getCurrentRunningTime () const
 Get game time passed since this event was set to running state, i.e. was showed to the player. More...
 
void setGreatJob (bool greatJob)
 Set whether or not the normal or great point gain should occur. More...
 
uint32 getNormalPointGain () const
 Get point gain on normal success. More...
 
void setNormalPointGain (uint32 pointGain)
 Set point gain on normal success. More...
 
uint32 getNormalCreditGain () const
 Get credit gain on campaign success. More...
 
void setNormalCreditGain (uint32 creditGain)
 Set credit gain on campaign success. More...
 
uint32 getMultiplayerPointGain () const
 Get point gain on multiplayer success. More...
 
void setMultiplayerPointGain (uint32 pointGain)
 Set point gain on multiplayer success. More...
 
State getState () const
 Get or set the music level of the event (high or low) More...
 
float getEventDensityIncrease () const
 Get event factor. More...
 
void setEventDensityIncrease (float eventDensityIncrease)
 Set event factor. More...
 
float getEventDensity () const
 Get the event density. More...
 
void setEventDensity (float density)
 Set event density. More...
 
bool deserializeEventFromBoostPTree (const boost::property_tree::ptree &pTree, qsf::Object::SerializationMethod serializationMethod=qsf::Object::SERIALIZE_IGNORE_UNKNOWN)
 Deserialize event properties. More...
 
uint32 getPlayerIndex () const
 Returns the player index to which the event is assigned. More...
 
void setPlayerIndex (uint32 playerIndex)
 Sets the player index to which the event is assigned. More...
 
bool isEventLocationEntitySet () const
 Return "true" if the event location entity is set, else "false". More...
 
qsf::EntitygetEventLocationEntity () const
 
bool isTimeout (const qsf::Time &timePassed)
 
virtual void hintCallbackWithMessage (Observer &hintObserver, const qsf::MessageParameters &parameters)
 
virtual void onTimerTriggered (uint32 timerId)
 
- Public Member Functions inherited from qsf::Object
virtual ~Object ()
 Destructor. More...
 
const camp::Class & getCampClass () const
 Return the CAMP class. More...
 
int getPropertyIndexById (const StringHash &propertyId) const
 Return the CAMP property index by using the unique class property ID. More...
 
uint32 getPropertyIdByIndex (int index) const
 Return the unique class property ID with the given index. More...
 
std::string getPropertyNameById (const StringHash &propertyId) const
 Return the CAMP property name by using the unique class property ID. More...
 
const camp::Property * getCampPropertyById (const StringHash &propertyId) const
 Return the CAMP property by using the unique class property ID. More...
 
void setPropertyValuesByString (const std::string &values)
 Set CAMP reflection property values by using a given string. More...
 
void setPropertiesToDefaultValues ()
 Set all CAMP reflection system properties to their default values. More...
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
void serializeToBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void deserializeFromBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL, bool setOverrideState=true)
 
virtual camp::Value getPropertyDefaultValue (const StringHash &propertyId) const
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState)
 
virtual void onPreDeserialize ()
 Called right before the object is deserialized using any of the above methods. Default implementation is empty. More...
 
virtual void onPostDeserialize ()
 Called right after the object was deserialized using any of the above methods. Default implementation is empty. More...
 
virtual ScriptgetAssociatedScript () const
 Return the script instance associated with this object instance. More...
 

Static Public Attributes

static const uint32 FREEPLAY_EVENT_ID
 "em5::MainEvent01" unique freeplay event ID More...
 
- Static Public Attributes inherited from em5::MainEvent
static const std::string SEQUENCE_FADEOUT
 
- Static Public Attributes inherited from em5::FreeplayEvent
static const uint32 GAME_TIMER_MESSAGE_ID
 "em5::FreeplayEvent_GameTimerMessage" unique message ID More...
 
static const std::string MUSIC_LEVEL_LOW
 
static const std::string MUSIC_LEVEL_HIGH
 

Protected Member Functions

virtual void onIntroStart (const qsf::MessageParameters &parameters) override
 React to the activation of the black screen, which is the start of the intro cutscene. More...
 
virtual void onIntroFinished (const qsf::MessageParameters &parameters) override
 React to the end of the intro; note that the prologue cutscene is played next. More...
 
virtual void onPrologueFinished (const qsf::MessageParameters &parameters) override
 React to the end of the prologue. More...
 
virtual void onUpdateMainEvent (const qsf::Time &timePassed) override
 Gets called when the main event gets an update call We use here a separate update method, which the main events should be implement to support the feature "Show entity which caused the failure". This feature needs that the base class gets update calls from the freeplay system. More...
 
virtual void onUpdateMusic (const qsf::Time &timePassed) override
 Gets called when the main event gets an update call We use here a separate update method, which the main events should be implement to support triggering of specific music tracks. More...
 
virtual uint32 getEventNumber () override
 Gets number of the main event (Is needed for the highscore management) More...
 
virtual void showSupervisorMessageForFinalEvaluation (uint32 pointGain) override
 Shows a supervisor message when the event ends. More...
 
- Protected Member Functions inherited from em5::MainEvent
virtual void onStartIntroRequest ()
 React to the intro start request; do only overwrite the default implementation if you really have to. More...
 
virtual std::string getCamStartEventTag ()
 Return event tag of a start camera for the event; only necessary for main events without prologue cutscene. More...
 
virtual void showBriefingSupervisorMessage ()
 Shows the briefing supervisor message for the event. More...
 
void activateLayer (const std::string &activate, bool showError=true)
 Activate a layer. More...
 
void deactivateLayer (const std::string &deactivate, bool showError=true, bool saveEntities=false)
 Deactivate a layer. More...
 
const std::string & getEventLayerName () const
 Get the event layer name. More...
 
const std::string & getEraseLayerName () const
 Get the erase layer name. More...
 
const std::string & getCutsceneLayerName () const
 Get the cut scene layer name. More...
 
void setPlayerControl (bool playerControl) const
 Set player control active / inactive. More...
 
void setGameSimulation (bool gameSimulation) const
 Set damage, fire and health simulation active / inactive. More...
 
void setCivilistSpawn (bool spawnEnabled) const
 Set civil cars and persons spawning active / inactive. More...
 
void setAiSimulation (bool aiSimulation) const
 Set AI simulation. More...
 
qsf::EntitygetScene () const
 Get the scene tag entity. More...
 
void setStartDayTimeAndWeather ()
 Set the current day time and weather of the event. More...
 
uint32 addObjectiveValue (const qsf::StringHash &objectiveId, EventResult &eventResult, uint32 pointValue) const
 Add objective text / point value pair to event result. More...
 
uint32 addObjectiveValue (const Objective *objective, EventResult &eventResult, uint32 pointValue) const
 Add objective text / point value pair to event result. More...
 
uint32 getEfficiencyPointValue () const
 Get the efficiency point gain. More...
 
void startIntro (bool forceNoFadeOut=false)
 Start the intro. More...
 
CutscenePlayergetCutscenePlayer () const
 Get the current cutscene player. More...
 
void flyCameraTo (qsf::Entity &targetCameraEntity, float maximumAcceleration=100.0f, float maximumSpeed=25.0f)
 Is moving the camera to the target entity to highlight a specific event, like a very small in-game cutscene. More...
 
void setMainEventFinished (bool successful, bool showFailedReason=true)
 Extended version of the setFinished. This method supports showing the entity which caused the failure of the event. More...
 
bool isNumberOfBurningObjectsBelowX (uint32 number)
 Is the number of burning objects in the event below x. More...
 
bool personsWithHealthBelowXPercent (float health)
 Is the health of all persons in the event below x. More...
 
bool isEntityGettingHeatDamage (const qsf::Entity &entity) const
 Is the specific entity getting some damage by heat or fire (not burning) More...
 
bool isObjectiveAccomplished (uint32 typeId)
 Check a given Objective if it is accompplished. More...
 
void setCurrentTime (const glm::vec2 &currentTime)
 
void triggerCampaignHeroAchievement () const
 The Campaign Hero achievement hase to be triggered on success of the last event in the campign. More...
 
- Protected Member Functions inherited from em5::FreeplayEvent
ObjectiveaddObjective (uint32 objectiveId, uint32 orderPriority=100)
 Add a new objective, i.e. win condition. More...
 
ObjectiveaddFailCondition (uint32 objectiveId, uint32 neededNumber, const std::string &objectiveText)
 Add a new fail condition (which is internally an objective as well) More...
 
ObjectiveListgetObjectives ()
 Return the objectives list. More...
 
void checkObjectivesState ()
 Check the objectives states and finish the event if necessary. More...
 
uint32 getFailReasonObjectiveTypeId (const ObjectiveList &objectives)
 Get the fail condition objectives type ID, of the event that is responsible for the failure of the event. More...
 
bool wasHintShown (const std::string &hintName) const
 
void showHint (const std::string &hintName, bool notMoreThanOnce, bool textOnly=false)
 
void showSupervisorMessage (const std::string &messageId, bool audioOnly=false)
 
void markHintAsAlreadyShown (const std::string &hintName)
 
ObservercreateObserverByTypeId (uint32 typeId, uint64 entityId, const std::string &name=std::string())
 Create a new observer of the specified type ID, inside the given entity. More...
 
template<typename T >
T & createObserver (uint64 entityId, const std::string &name=std::string())
 Create a new observer of the specified type, inside the given entity. More...
 
ObservercreateGeneralObserverByTypeId (uint32 typeId, const std::string &name=std::string())
 Create a new general observer (i.e. not bound to a single entity, but observing the whole map) of the specified type ID. More...
 
template<typename T >
T & createGeneralObserver (const std::string &name=std::string())
 Create a new general observer (i.e. not bound to a single entity, but observing the whole map) of the specified type. More...
 
ObservergetObserverByTypeId (uint32 typeId, uint64 entityId)
 Find an existing observer of the specified type ID, inside the given entity. More...
 
void removeObserver (Observer &observer)
 Removes and destroys the given observer. More...
 
void informFreeplaySystemAboutBeFinished ()
 
void createEventLocationEntity (qsf::Entity &entity)
 Create the event location entity for use with getFocusEntity. More...
 
void createEventLocationEntity (const glm::vec3 &position)
 Create the event location entity for use with getFocusEntity. More...
 
qsf::DynamicMusicCompositorComponentgetDynamicMusicCompositor () const
 
bool isMiniEvent () const
 
void setFailHintsForMiniEvent (EventResult &eventResult, const std::string &failedText, const std::string &miniEventSupervisorMessage, const std::string &standardEventHint="")
 
void startTimer (uint32 timerId, qsf::Time waitTime)
 
void setTimer (uint32 timerId, qsf::Time waitTime)
 
void cancelTimer (uint32 timerId)
 
void triggerTimer (uint32 timerId)
 
bool checkDebugButton (const std::string &buttonName)
 
- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::WeakPtrTarget
 WeakPtrTarget ()
 Default constructor. More...
 
 WeakPtrTarget (const WeakPtrTarget &other)
 Copy constructor. More...
 
 WeakPtrTarget (WeakPtrTarget &&)=delete
 Delete the move constructor, as WeakPtrTarget would need a proper move constructor-implementation that ensures that its pointer gets updated in the WeakPtrBase as well. More...
 
 ~WeakPtrTarget ()
 Destructor. More...
 
void invalidateAllWeakPtr ()
 Invalidate all weak pointers to this object. More...
 
void operator= (const WeakPtrTarget &other)
 Copy operator. More...
 

Friends

class MainEventMetaclasses
 
class MainEvent01DebugGui
 

Additional Inherited Members

- Public Types inherited from em5::FreeplayEvent
enum  State { STATE_HIDDEN = 0, STATE_RUNNING, STATE_SUCCESS, STATE_FAILED }
 
enum  EventFlag { EventFlag::WORLD_EVENT, EventFlag::MINI_EVENT }
 
typedef qsf::EnumBitmask< uint8, EventFlagEventFlagSet
 
typedef ObjectiveList::ObjectiveInstanceMap ObjectiveInstanceMap
 
typedef std::vector< uint64EntityIdArray
 
typedef boost::container::flat_map< std::string, int > ObjectivePoints
 
typedef std::vector< RecordedHintSystemMessageRecordedHintSystemMessages
 
- Public Types inherited from qsf::Object
enum  PropertyOverrideState { PROPERTY_INVALID, PROPERTY_DEFAULT, PROPERTY_OVERRIDE, PROPERTY_REMOVED }
 
enum  SerializationMethod { SERIALIZE_FLAT, SERIALIZE_COMPLETE, SERIALIZE_DIFFERENTIAL, SERIALIZE_IGNORE_UNKNOWN }
 
enum  SerializationMode { MODE_MINIMAL, MODE_COMPATIBLE }
 
- Protected Attributes inherited from em5::MainEvent
uint32 mMinEfficiencyPoints
 
uint32 mMaxEfficiencyPoints
 
qsf::Time mMinEfficiencyTime
 
qsf::Time mMaxEfficiencyTime
 
uint32 mNeededPointsForGold
 
uint32 mNeededPointsForSilver
 
qsf::MessageProxy mLifeCycleMessageProxy
 Listens to messages that affect the lifecycle. More...
 

Detailed Description

EMERGENCY 5 main event 01 "Munich tram accident".

Constructor & Destructor Documentation

em5::MainEvent01::MainEvent01 ( )

Default constructor.

virtual em5::MainEvent01::~MainEvent01 ( )
virtual

Destructor.

Member Function Documentation

virtual bool em5::MainEvent01::addEntityToEvent ( qsf::Entity targetEntity,
eventspreadreason::Reason  eventSpreadReason,
bool  newReason 
)
overridevirtual

React to adding to an entity to this event, i.e. setting the event ID for the entity.

Parameters
[in]targetEntityThe entity just added; could already have been added before
[in]eventSpreadReasonThe reason why this entity was added
[in]newReason"true" if either the entity was not associated with this event before or if it was added with another event spread reason
Returns
"true" if the entity is added correctly to the event

Reimplemented from em5::FreeplayEvent.

virtual uint32 em5::MainEvent01::calculatePointGain ( EventResult eventResult)
overridevirtual

Calculate the point gain for this event.

Reimplemented from em5::MainEvent.

virtual uint32 em5::MainEvent01::getEventNumber ( )
overrideprotectedvirtual

Gets number of the main event (Is needed for the highscore management)

Implements em5::MainEvent.

virtual const qsf::Entity* em5::MainEvent01::getFocusEntity ( )
overridevirtual

Get an event entity that is currently crucial for this event This is the entity which gets the focus when the player clicks on go to event.

Reimplemented from em5::FreeplayEvent.

virtual void em5::MainEvent01::hintCallback ( Observer hintObserver)
overridevirtual

Handle the activation of a hint observer.

Reimplemented from em5::FreeplayEvent.

virtual bool em5::MainEvent01::onFailure ( EventResult eventResult)
overridevirtual

React to state change from running state to failed state.

Returns
"true" when the freeplay system should be informed immediately, otherwise false (When false then the freeplay event is responsible to call informFreeplaySystemAboutBeFinished)

Reimplemented from em5::MainEvent.

virtual void em5::MainEvent01::onIntroFinished ( const qsf::MessageParameters parameters)
overrideprotectedvirtual

React to the end of the intro; note that the prologue cutscene is played next.

Reimplemented from em5::MainEvent.

virtual void em5::MainEvent01::onIntroStart ( const qsf::MessageParameters parameters)
overrideprotectedvirtual

React to the activation of the black screen, which is the start of the intro cutscene.

Reimplemented from em5::MainEvent.

virtual void em5::MainEvent01::onPrologueFinished ( const qsf::MessageParameters parameters)
overrideprotectedvirtual

React to the end of the prologue.

Reimplemented from em5::MainEvent.

virtual void em5::MainEvent01::onRun ( )
overridevirtual

React to state change from (initial) hidden state to running state.

Note
  • Default implementation is empty

Reimplemented from em5::FreeplayEvent.

virtual void em5::MainEvent01::onShutdown ( )
overridevirtual

React to shutdown of the freeplay event.

Note
  • Default implementation is empty

Reimplemented from em5::MainEvent.

virtual bool em5::MainEvent01::onStartup ( )
overridevirtual

React to startup of the freeplay event.

Note
  • Default implementation simply returns "true"

Reimplemented from em5::MainEvent.

virtual bool em5::MainEvent01::onSuccess ( EventResult eventResult)
overridevirtual

React to state change from running state to success state.

Returns
"true" when the freeplay system should be informed immediately, otherwise false (When false then the freeplay event is responsible to call informFreeplaySystemAboutBeFinished)
Note
  • Default implementation is empty

Reimplemented from em5::MainEvent.

virtual void em5::MainEvent01::onUpdateMainEvent ( const qsf::Time timePassed)
overrideprotectedvirtual

Gets called when the main event gets an update call We use here a separate update method, which the main events should be implement to support the feature "Show entity which caused the failure". This feature needs that the base class gets update calls from the freeplay system.

Reimplemented from em5::MainEvent.

virtual void em5::MainEvent01::onUpdateMusic ( const qsf::Time timePassed)
overrideprotectedvirtual

Gets called when the main event gets an update call We use here a separate update method, which the main events should be implement to support triggering of specific music tracks.

Reimplemented from em5::MainEvent.

virtual void em5::MainEvent01::serialize ( qsf::BinarySerializer serializer)
overridevirtual

Serialization using a binary serializer.

Reimplemented from em5::MainEvent.

virtual void em5::MainEvent01::showSupervisorMessageForFinalEvaluation ( uint32  pointGain)
overrideprotectedvirtual

Shows a supervisor message when the event ends.

Reimplemented from em5::MainEvent.

Friends And Related Function Documentation

friend class MainEvent01DebugGui
friend
friend class MainEventMetaclasses
friend

Member Data Documentation

const uint32 em5::MainEvent01::FREEPLAY_EVENT_ID
static

"em5::MainEvent01" unique freeplay event ID


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