2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CENTITY_HPP__
|
|
|
|
#define __URDE_CENTITY_HPP__
|
2015-08-19 05:48:57 +00:00
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "ScriptObjectSupport.hpp"
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-19 05:48:57 +00:00
|
|
|
{
|
2015-08-22 01:58:41 +00:00
|
|
|
class CStateManager;
|
2016-04-16 21:49:47 +00:00
|
|
|
class IVisitor;
|
2015-08-19 05:48:57 +00:00
|
|
|
|
|
|
|
struct SConnection
|
|
|
|
{
|
|
|
|
EScriptObjectState state;
|
|
|
|
EScriptObjectMessage msg;
|
|
|
|
TEditorId objId;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CEntityInfo
|
|
|
|
{
|
|
|
|
friend class CEntity;
|
|
|
|
TAreaId m_aid;
|
|
|
|
std::vector<SConnection> m_conns;
|
|
|
|
public:
|
|
|
|
CEntityInfo(TAreaId aid, const std::vector<SConnection>& conns)
|
|
|
|
: m_aid(aid), m_conns(conns) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class CEntity
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
TUniqueId m_uid;
|
|
|
|
CEntityInfo m_info;
|
|
|
|
bool m_active = false;
|
|
|
|
public:
|
|
|
|
virtual ~CEntity() {}
|
|
|
|
CEntity(TUniqueId uid, const CEntityInfo& info, bool active);
|
2016-04-16 21:49:47 +00:00
|
|
|
virtual void Accept(IVisitor&)=0;
|
2015-08-19 05:48:57 +00:00
|
|
|
virtual void PreThink(float, CStateManager&) {}
|
|
|
|
virtual void Think(float, CStateManager&) {}
|
|
|
|
virtual void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
|
|
|
|
virtual bool GetActive() const {return m_active;}
|
|
|
|
virtual void SetActive(bool active) {m_active = active;}
|
|
|
|
|
2016-04-16 21:49:47 +00:00
|
|
|
TUniqueId GetUniqueId() const {return m_uid;}
|
2015-08-19 05:48:57 +00:00
|
|
|
void SendScriptMsgs(EScriptObjectState state, CStateManager& stateMgr, EScriptObjectMessage msg);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CENTITY_HPP__
|