Plasma Engine  2.0
Loading...
Searching...
No Matches
TimedDeathComponent.h
1#pragma once
2
3#include <Core/ResourceManager/ResourceHandle.h>
4#include <Core/World/Component.h>
5#include <Core/World/World.h>
6#include <Foundation/Time/Time.h>
7#include <GameEngine/GameEngineDLL.h>
8
12
18class PL_GAMEENGINE_DLL plTimedDeathComponent : public plComponent
19{
21
23 // plComponent
24
25public:
26 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
27 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
28
29protected:
31 virtual void OnSimulationStarted() override;
32
33
35 // plTimedDeathComponent
36
37public:
40
41 plTime m_MinDelay = plTime::MakeFromSeconds(1.0); // [ property ]
42 plTime m_DelayRange = plTime::MakeFromSeconds(0.0); // [ property ]
43
44 void SetTimeoutPrefab(const char* szPrefab); // [ property ]
45 const char* GetTimeoutPrefab() const; // [ property ]
46
47protected:
48 void OnTriggered(plMsgComponentInternalTrigger& msg);
49
51};
Base class of all component types.
Definition Component.h:25
virtual void SerializeComponent(plWorldWriter &inout_stream) const
Override this to save the current state of the component to the given stream.
Definition Component.cpp:54
virtual void OnSimulationStarted()
This method is called once for active components, at the start of the next world update,...
Definition Component.cpp:144
virtual void DeserializeComponent(plWorldReader &inout_stream)
Override this to load the current state of the component from the given stream.
Definition Component.cpp:58
Definition ComponentManager.h:88
This component deletes the object it is attached to after a timeout.
Definition TimedDeathComponent.h:19
plPrefabResourceHandle m_hTimeoutPrefab
Spawned when the component is killed due to the timeout.
Definition TimedDeathComponent.h:50
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
For internal use by components to trigger some known behavior. Usually components will post this mess...
Definition TriggerMessage.h:26
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
PL_ALWAYS_INLINE static constexpr plTime MakeFromSeconds(double fSeconds)
Creates an instance of plTime that was initialized from seconds.
Definition Time.h:30