Files
Destrum/lightkeeper/include/components/PlayerRespawn.h
T

36 lines
993 B
C++

#ifndef LIGHTKEEPER_PLAYERRESPAWN_H
#define LIGHTKEEPER_PLAYERRESPAWN_H
#include <glm/vec3.hpp>
#include <destrum/ObjectModel/Component.h>
class PlayerRespawn final : public Component {
public:
explicit PlayerRespawn(GameObject& parent);
std::string GetTypeName() const override { return "PlayerRespawn"; }
void Start() override;
void FixedUpdate(float fixedDt) override;
nlohmann::json Serialize() const override;
void Deserialize(const nlohmann::json& data) override;
void ImGuiInspector() override;
void SetRespawnPoint(const glm::vec3& worldPosition);
[[nodiscard]] const glm::vec3& GetRespawnPoint() const { return m_RespawnPoint; }
void SetKillHeight(float height) { m_KillHeight = height; }
[[nodiscard]] float GetKillHeight() const { return m_KillHeight; }
void Respawn();
private:
glm::vec3 m_RespawnPoint{0.0f};
bool m_HasRespawnPoint{false};
float m_KillHeight{-15.0f};
};
#endif // LIGHTKEEPER_PLAYERRESPAWN_H