Я пересоздал репозиторий из-за большого количества мусора в прошлом

This commit is contained in:
Jiga228
2025-09-14 15:00:44 +07:00
commit 78a25b305b
74 changed files with 3428 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
#include "Actor.h"
#include "Game/SaveMap/SaveMap.h"
#include "Log/Log.h"
Actor::Actor()
{
SetType(Classes::Actor);
}
std::shared_ptr<SaveMap> Actor::save() noexcept
{
std::shared_ptr<SaveMap> save = std::make_shared<SaveMap>("Actor");
save->SaveObject("loc", &loc)
->SaveObject("rot", &rot)
->SaveObject("scale", &scale)
->SaveListStrings("tags", std::move(tags));
return save;
}
void Actor::load(std::shared_ptr<SaveMap> save) noexcept
{
loc = *reinterpret_cast<Vector3D*>(save->GetObject("loc"));
rot = *reinterpret_cast<Vector3D*>(save->GetObject("rot"));
scale = *reinterpret_cast<Vector3D*>(save->GetObject("scale"));
tags = std::move(save->GetListString("tags"));
}
void Actor::BeginPlay()
{
Log("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);
}
+51
View File
@@ -0,0 +1,51 @@
#pragma once
#include <list>
#include "RTTI.h"
#include "RTTI_Meta.h"
#include "Game/SaveMap/ISave.h"
#include "Delegate/Delegate.h"
#include "Math/Vector.h"
GENERATE_META(Actor)
class Actor : public ISave, public IRTTI
{
Vector3D loc;
Vector3D rot;
Vector3D scale;
std::list<std::string> tags;
public:
Actor();
Delegate<const Vector3D&> OnSetActorLocate;
Delegate<const Vector3D&> OnSetActorRotate;
#pragma region ISave
virtual std::shared_ptr<SaveMap> save() noexcept override;
virtual void load(std::shared_ptr<SaveMap> save) noexcept override;
#pragma endregion
virtual void BeginPlay();
virtual void Tick(double delta_time);
/*
* Изменяет положение в пространстве
* Вызывает делегат OnSetActorLocate
*/
void SetActorLocate(const Vector3D& loc) noexcept;
inline const Vector3D& GetActorLocate() const { return loc; }
/*
* Изменяет ориентацию в пространстве
* Вызывает делегат OnSetActorRotate
*/
void SetActorRotate(const Vector3D& rot) noexcept;
inline const Vector3D& GetActorRotate() const { return rot; }
void AddTag(const std::string& tag) noexcept;
void RemoveTag(const std::string& tag) noexcept;
const std::list<std::string>& GetTags() const { return tags; }
};