Plasma Engine  2.0
Loading...
Searching...
No Matches
MoveToComponent.h
1#pragma once
2
3#include <GameComponentsPlugin/GameComponentsDLL.h>
4
5#include <Core/Messages/CommonMessages.h>
6#include <Core/World/Component.h>
7#include <Core/World/World.h>
8#include <Foundation/Time/Time.h>
9
11{
12 using StorageType = plUInt16;
13
14 enum Enum
15 {
16 None = 0,
17 Running = PL_BIT(0),
18 Default = None
19 };
20
21 struct Bits
22 {
23 StorageType Running : 1;
24 };
25};
26
28
29PL_DECLARE_FLAGS_OPERATORS(plMoveToComponentFlags);
30
44class PL_GAMECOMPONENTS_DLL plMoveToComponent : public plComponent
45{
46 PL_DECLARE_COMPONENT_TYPE(plMoveToComponent, plComponent, plMoveToComponentManager);
47
49 // plComponent
50
51public:
52 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
53 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
54
55
57 // plTransformComponent
58
59public:
62
64 void SetRunning(bool bRunning); // [ property ]
65 bool IsRunning() const; // [ property ]
66
67 void SetTargetPosition(const plVec3& vPos); // [ scriptable ]
68
69protected:
70 void Update();
71
72 plEventMessageSender<plMsgAnimationReachedEnd> m_ReachedEndMsgSender; // [ event ]
73
74 float m_fCurTranslationSpeed = 0;
75 float m_fMaxTranslationSpeed = 1; // [ property ]
76 float m_fTranslationAcceleration = 0; // [ property ]
77 float m_fTranslationDeceleration = 0; // [ property ]
78
79 plVec3 m_vTargetPosition;
81};
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 DeserializeComponent(plWorldReader &inout_stream)
Override this to load the current state of the component from the given stream.
Definition Component.cpp:58
Simple component manager implementation that calls an update method on all components every frame.
Definition ComponentManager.h:142
A message sender that sends all messages to the next component derived from plEventMessageHandlerComp...
Definition EventMessage.h:39
A light-weight component that moves the owner object towards a single position.
Definition MoveToComponent.h:45
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
Definition MoveToComponent.h:22
Definition MoveToComponent.h:11