Plasma Engine  2.0
Loading...
Searching...
No Matches
CollectionComponent.h
1#pragma once
2
3#include <Core/Collection/CollectionResource.h>
4#include <Core/CoreDLL.h>
5#include <Core/World/Component.h>
6#include <Core/World/World.h>
7
9
17class PL_CORE_DLL plCollectionComponent : 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 // plCollectionComponent
32public:
35
36 void SetCollectionFile(const char* szFile); // [ property ]
37 const char* GetCollectionFile() const; // [ property ]
38
39 void SetCollection(const plCollectionResourceHandle& hPrefab);
40 PL_ALWAYS_INLINE const plCollectionResourceHandle& GetCollection() const { return m_hCollection; }
41
42protected:
44 void InitiatePreload();
45
46 bool m_bRegisterNames = false;
47 plCollectionResourceHandle m_hCollection;
48};
An plCollectionComponent references an plCollectionResource and triggers resource preloading when nee...
Definition CollectionComponent.h:18
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
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