Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+78
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
#include <dtEntity/commandmessages.h>
|
||||
#include <dtEntity/systemmessages.h>
|
||||
#include <dtEntity/component.h>
|
||||
#include <dtEntity/entity.h>
|
||||
#include <dtEntity/defaultentitysystem.h>
|
||||
#include <osgSim/DOFTransform>
|
||||
#include <dtEntity/dynamicproperty.h>
|
||||
|
||||
namespace VCtrl
|
||||
{
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class RoomDestructionComponent final : public dtEntity::Component
|
||||
{
|
||||
|
||||
public:
|
||||
static const dtEntity::StringId TYPE;
|
||||
|
||||
dtEntity::ComponentType GetType() const override { return TYPE; }
|
||||
|
||||
virtual bool IsInstanceOf(dtEntity::ComponentType id) const
|
||||
{
|
||||
return ((id == TYPE));
|
||||
}
|
||||
|
||||
void OnAddedToEntity(dtEntity::Entity &entity) override
|
||||
{
|
||||
mEntity = &entity;
|
||||
}
|
||||
|
||||
void OnEnteredWorld();
|
||||
|
||||
void OnRemovedFromEntity(dtEntity::Entity &) override
|
||||
{
|
||||
mEntity = nullptr;
|
||||
}
|
||||
|
||||
bool SetRoomDestructionValue(const std::string &room, float value);
|
||||
bool SetBuildingDestructionValue(float value);
|
||||
|
||||
using RoomDestructions = std::map<std::string, float>;
|
||||
|
||||
const RoomDestructions &GetRoomDestructions() const
|
||||
{
|
||||
return mRoomDestructions;
|
||||
}
|
||||
private:
|
||||
|
||||
RoomDestructions mRoomDestructions;
|
||||
dtEntity::Entity *mEntity = nullptr;
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////
|
||||
|
||||
|
||||
// iterates over MovementComponents and updates the translation of the entity
|
||||
// after applying forces
|
||||
class RoomDestructionSystem final
|
||||
: public dtEntity::DefaultEntitySystem<RoomDestructionComponent>
|
||||
{
|
||||
|
||||
public:
|
||||
static const dtEntity::StringId TYPE;
|
||||
|
||||
explicit RoomDestructionSystem(dtEntity::EntityManager &em);
|
||||
void OnEnterWorld(const dtEntity::Message &msg);
|
||||
|
||||
private:
|
||||
|
||||
dtEntity::MessageFunctor mEnterWorldFunctor;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user