Plasma Engine  2.0
Loading...
Searching...
No Matches
ColorAnimationComponent.h
1#pragma once
2
3#include <GameEngine/GameEngineDLL.h>
4
5#include <Core/Curves/ColorGradientResource.h>
6#include <Core/Messages/SetColorMessage.h>
7#include <Core/World/Component.h>
8#include <Core/World/World.h>
9#include <GameEngine/Animation/PropertyAnimResource.h>
10
12
17class PL_GAMEENGINE_DLL plColorAnimationComponent : public plComponent
18{
20
22 // plComponent
23public:
24 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
25 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
26
27protected:
28 virtual void OnSimulationStarted() override;
29
31 // plColorAnimationComponent
32public:
34
36 plTime m_Duration; // [ property ]
37
38 void SetColorGradientFile(const char* szFile); // [ property ]
39 const char* GetColorGradientFile() const; // [ property ]
40
41 void SetColorGradient(const plColorGradientResourceHandle& hResource);
42 PL_ALWAYS_INLINE const plColorGradientResourceHandle& GetColorGradient() const { return m_hGradient; }
43
46
49
50 bool GetApplyRecursive() const; // [ property ]
51 void SetApplyRecursive(bool value); // [ property ]
52
53 bool GetRandomStartOffset() const; // [ property ]
54 void SetRandomStartOffset(bool value); // [ property ]
55
56protected:
57 void Update();
58
59 plTime m_CurAnimTime;
61};
Samples a color gradient and sends an plMsgSetColor to the object it is attached to.
Definition ColorAnimationComponent.h:18
plEnum< plPropertyAnimMode > m_AnimationMode
How the animation should be played and looped.
Definition ColorAnimationComponent.h:45
plEnum< plSetColorMode > m_SetColorMode
How the color should be applied to the target.
Definition ColorAnimationComponent.h:48
plTime m_Duration
How long it takes to sample the entire color gradient.
Definition ColorAnimationComponent.h:36
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
Simple component manager implementation that calls an update method on all components every frame.
Definition ComponentManager.h:142
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
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12