This commit is contained in:
Jiga228
2025-10-18 17:08:50 +07:00
parent d79258e191
commit 1ba310ba92
7 changed files with 21 additions and 25 deletions
+9 -9
View File
@@ -8,7 +8,7 @@ void Actor::OnDestroy()
{
}
Actor::Actor() : loc(new Vector3D), rot(new Vector3D), scale(new Vector3D)
Actor::Actor() : loc_(new Vector3D), rot_(new Vector3D), scale_(new Vector3D)
{
SetType(Classes::Actor);
}
@@ -16,17 +16,17 @@ Actor::Actor() : loc(new Vector3D), rot(new Vector3D), scale(new Vector3D)
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))
->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"));
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"));
}
@@ -40,13 +40,13 @@ void Actor::Tick(double delta_time)
void Actor::SetActorLocate(const Vector3D& loc) noexcept
{
*this->loc = loc;
*this->loc_ = loc;
OnSetActorLocate.Call(loc);
}
void Actor::SetActorRotate(const Vector3D& rot) noexcept
{
*this->rot = rot;
*this->rot_ = rot;
OnSetActorRotate.Call(rot);
}