62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
#include "Actor.hpp"
|
|
|
|
#include "Game/SaveMap/SaveMap.hpp"
|
|
#include "Game/World/World.hpp"
|
|
#include "Log/Log.hpp"
|
|
|
|
void Actor::OnDestroy()
|
|
{
|
|
}
|
|
|
|
Actor::Actor() : loc(new Vector3D), rot(new Vector3D), scale(new Vector3D)
|
|
{
|
|
SetType(Classes::Actor);
|
|
}
|
|
|
|
std::shared_ptr<SaveMap> Actor::save()
|
|
{
|
|
return std::make_shared<SaveMap>("Actor")
|
|
->SaveObject("loc", static_cast<UType::object_ptr<ISave>>(loc))
|
|
->SaveObject("rot", static_cast<UType::object_ptr<ISave>>(rot))
|
|
->SaveObject("scale", UType::object_ptr<ISave>(scale))
|
|
->SaveListStrings("tags", std::move(tags));
|
|
}
|
|
|
|
void Actor::load(std::shared_ptr<SaveMap> save)
|
|
{
|
|
loc = static_cast<UType::object_ptr<Vector3D>>(save->GetObject("loc"));
|
|
rot = static_cast<UType::object_ptr<Vector3D>>(save->GetObject("rot"));
|
|
scale = static_cast<UType::object_ptr<Vector3D>>(save->GetObject("scale"));
|
|
tags = std::move(save->GetListString("tags"));
|
|
}
|
|
|
|
void Actor::BeginPlay()
|
|
{
|
|
}
|
|
|
|
void Actor::Tick(double delta_time)
|
|
{
|
|
}
|
|
|
|
void Actor::SetActorLocate(const Vector3D& loc) noexcept
|
|
{
|
|
*this->loc = loc;
|
|
OnSetActorLocate.Call(loc);
|
|
}
|
|
|
|
void Actor::SetActorRotate(const Vector3D& rot) noexcept
|
|
{
|
|
*this->rot = rot;
|
|
OnSetActorRotate.Call(rot);
|
|
}
|
|
|
|
void Actor::AddTag(const std::string& tag) noexcept
|
|
{
|
|
tags.push_back(tag);
|
|
}
|
|
|
|
void Actor::RemoveTag(const std::string& tag) noexcept
|
|
{
|
|
tags.remove(tag);
|
|
}
|