60 lines
1.4 KiB
C++
Executable File
60 lines
1.4 KiB
C++
Executable File
#pragma once
|
|
|
|
#include <dtEntity/defaultentitysystem.h>
|
|
#include <dtEntity/component.h>
|
|
#include <dtEntity/message.h>
|
|
#include <dtEntity/stringid.h>
|
|
#include <dtEntity/dynamicproperty.h>
|
|
#include <dtEntity/scriptaccessor.h>
|
|
|
|
namespace VCtrl
|
|
{
|
|
|
|
|
|
class ModelSplitterComponent final : public dtEntity::Component
|
|
{
|
|
|
|
using BaseClass = dtEntity::Component;
|
|
|
|
public:
|
|
|
|
static const dtEntity::ComponentType TYPE;
|
|
static const dtEntity::StringId VerticalDisplaceId;
|
|
static const dtEntity::StringId HorizontalDisplaceId;
|
|
|
|
|
|
ModelSplitterComponent();
|
|
|
|
void OnAddedToEntity(dtEntity::Entity &entity) override;
|
|
|
|
dtEntity::ComponentType GetType() const override { return TYPE; }
|
|
|
|
void Split(std::vector<dtEntity::EntityId> &eids, std::vector<float> &heights, std::vector<int> &floors, dtEntity::StringId layerName);
|
|
|
|
dtEntity::FloatProperty mVerticalDisplace;
|
|
dtEntity::Vec2Property mHorizontalDisplace;
|
|
|
|
void SetBuildingId(dtEntity::StringId id) { mBuildingId = id; }
|
|
dtEntity::StringId GetBuildingId() const { return mBuildingId; }
|
|
|
|
private:
|
|
dtEntity::Entity *mEntity = nullptr;
|
|
dtEntity::StringId mBuildingId = 0;
|
|
};
|
|
|
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
class ModelSplitterSystem final
|
|
: public dtEntity::DefaultEntitySystem<ModelSplitterComponent>
|
|
, public dtEntity::ScriptAccessor
|
|
{
|
|
public:
|
|
explicit ModelSplitterSystem(dtEntity::EntityManager &em);
|
|
|
|
static const dtEntity::ComponentType TYPE;
|
|
|
|
};
|
|
|
|
}
|