#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 Actor::save() { return std::make_shared("Actor") ->SaveObject("loc", static_cast>(loc_)) ->SaveObject("rot", static_cast>(rot_)) ->SaveObject("scale", UType::object_ptr(scale_)) ->SaveListStrings("tags", std::move(tags)); } void Actor::load(std::shared_ptr save) { loc_ = static_cast>(save->GetObject("loc")); rot_ = static_cast>(save->GetObject("rot")); scale_ = static_cast>(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); }