metaforce/Runtime/World/CScriptGrapplePoint.cpp

69 lines
1.7 KiB
C++
Raw Normal View History

2016-04-20 21:07:18 +00:00
#include "CScriptGrapplePoint.hpp"
#include "Character/CModelData.hpp"
#include "Collision/CMaterialList.hpp"
#include "CActorParameters.hpp"
2017-01-15 03:07:01 +00:00
#include "TCastTo.hpp"
2016-04-20 21:07:18 +00:00
namespace urde
{
2017-11-13 06:19:18 +00:00
CScriptGrapplePoint::CScriptGrapplePoint(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform &transform, bool active,
const CGrappleParameters &params)
2018-06-21 00:57:57 +00:00
: CActor(uid, active, name, info, transform, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Orbit),
CActorParameters::None(),
kInvalidUniqueId),
xe8_touchBounds(x34_transform.origin - 0.5f, x34_transform.origin + 0.5f),
x100_parameters(params)
2016-04-20 21:07:18 +00:00
{
}
2017-01-15 03:07:01 +00:00
void CScriptGrapplePoint::Accept(IVisitor& visitor)
{
visitor.Visit(this);
}
2018-06-21 00:57:57 +00:00
void CScriptGrapplePoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr)
{
switch (msg)
{
case EScriptObjectMessage::Activate:
if (!GetActive())
{
AddMaterial(EMaterialTypes::Orbit, mgr);
SetActive(true);
}
break;
case EScriptObjectMessage::Deactivate:
if (GetActive())
{
RemoveMaterial(EMaterialTypes::Orbit, mgr);
SetActive(false);
}
break;
default:
break;
}
}
void CScriptGrapplePoint::Think(float, CStateManager&)
{
// Empty
}
void CScriptGrapplePoint::Render(const CStateManager&) const
{
// Empty
}
std::experimental::optional<zeus::CAABox> CScriptGrapplePoint::GetTouchBounds() const
{
return {xe8_touchBounds};
}
void CScriptGrapplePoint::AddToRenderer(const zeus::CFrustum&, const CStateManager& mgr) const
{
CActor::EnsureRendered(mgr);
}
2016-04-20 21:07:18 +00:00
}