Plasma Engine  2.0
Loading...
Searching...
No Matches
RaycastComponent.h
1
2#pragma once
3
4#include <Core/Messages/TriggerMessage.h>
5#include <Core/World/Component.h>
6#include <Core/World/World.h>
7#include <GameComponentsPlugin/GameComponentsDLL.h>
8
10
11class plRaycastComponentManager : public plComponentManager<class plRaycastComponent, plBlockStorageType::Compact>
12{
14
15public:
17
18 virtual void Initialize() override;
19
20 void Update(const plWorldModule::UpdateContext& context);
21};
22
40class PL_GAMECOMPONENTS_DLL plRaycastComponent : public plComponent
41{
42 PL_DECLARE_COMPONENT_TYPE(plRaycastComponent, plComponent, plRaycastComponentManager);
43
45 // plComponent
46
47public:
48 virtual void OnSimulationStarted() override;
49
50 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
51 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
52
53protected:
54 void Deinitialize() override;
55
56 void OnActivated() override;
57 void OnDeactivated() override;
58
60 // plRaycastComponent
61
62public:
65
66 void SetTriggerMessage(const char* szSz); // [ property ]
67 const char* GetTriggerMessage() const; // [ property ]
68
69 void SetRaycastEndObject(const char* szReference); // [ property ]
70
71 plGameObjectHandle m_hRaycastEndObject; // [ property ]
72 float m_fMaxDistance = 100.0f; // [ property ]
73 bool m_bForceTargetParentless = false; // [ property ]
74 bool m_bDisableTargetObjectOnNoHit = false; // [ property ]
75 plUInt8 m_uiCollisionLayerEndPoint = 0; // [ property ]
76 plUInt8 m_uiCollisionLayerTrigger = 0; // [ property ]
77 plBitflags<plPhysicsShapeType> m_ShapeTypesToHit; // [ property ]
78
79private:
80 void Update();
81
82 plHashedString m_sTriggerMessage; // [ property ]
83 plEventMessageSender<plMsgTriggerTriggered> m_TriggerEventSender; // [ event ]
84
85private:
86 void PostTriggerMessage(plTriggerState::Enum state, plGameObjectHandle hObject);
87
88 const char* DummyGetter() const { return nullptr; }
89
90 plPhysicsWorldModuleInterface* m_pPhysicsWorldModule = nullptr;
91 plGameObjectHandle m_hLastTriggerObjectInRay;
92};
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 OnDeactivated()
This method is called when the component gets deactivated.
Definition Component.cpp:142
virtual void Deinitialize()
This method is called before the component is destroyed. A derived type can override this method to d...
Definition Component.cpp:133
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
virtual void OnActivated()
This method is called when the component gets activated.
Definition Component.cpp:140
Definition ComponentManager.h:88
A message sender that sends all messages to the next component derived from plEventMessageHandlerComp...
Definition EventMessage.h:39
This class is optimized to take nearly no memory (sizeof(void*)) and to allow very fast checks whethe...
Definition HashedString.h:25
Definition PhysicsWorldModule.h:109
A component which does a ray cast and positions a target object there.
Definition RaycastComponent.h:41
Definition RaycastComponent.h:12
virtual void Initialize() override
This method is called after the constructor. A derived type can override this method to do initializa...
Definition RaycastComponent.cpp:16
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
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
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
A handle to a game object.
Definition Declarations.h:76
Enum
Definition TriggerMessage.h:12
Definition WorldModule.h:33