Files

62 lines
1.5 KiB
C++

#pragma once
#include <list>
#include "RTTI.h"
#include "RTTI_Meta.h"
#include "Game/SaveMap/ISave.h"
#include "Delegate/Delegate.h"
#include "Math/Vector.hpp"
class World;
GENERATE_META(Actor)
class Actor : public ISave, public IRTTI
{
World* world_;
std::string name_;
std::shared_ptr<Vector3D> loc_, rot_, scale_;
std::list<std::string> tags;
protected:
virtual void OnDestroy();
public:
Actor();
Delegate<const Vector3D&> OnSetActorLocate;
Delegate<const Vector3D&> OnSetActorRotate;
#pragma region ISave
std::shared_ptr<SaveMap> save() override;
void load(std::shared_ptr<SaveMap> save) override;
#pragma endregion
virtual void BeginPlay();
virtual void Tick(double delta_time);
/*
* Изменяет положение в пространстве
* Вызывает делегат OnSetActorLocate
*/
void SetActorLocate(const Vector3D& loc) noexcept;
inline Vector3D GetActorLocate() const { return *loc_; }
/*
* Изменяет ориентацию в пространстве
* Вызывает делегат OnSetActorRotate
*/
void SetActorRotate(const Vector3D& rot) noexcept;
inline 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; }
World* GetWorld() const { return world_; }
const std::string& GetName() const { return name_; }
friend class World;
};