38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#ifndef LIGHTKEEPER_MOVINGPLATFORM_H
|
|
#define LIGHTKEEPER_MOVINGPLATFORM_H
|
|
|
|
#include <destrum/ObjectModel/Component.h>
|
|
|
|
#include <glm/vec3.hpp>
|
|
|
|
class MovingPlatform final : public Component {
|
|
public:
|
|
explicit MovingPlatform(GameObject& parent);
|
|
|
|
std::string GetTypeName() const override { return "MovingPlatform"; }
|
|
|
|
void Start() override;
|
|
void Update(float dt) override;
|
|
|
|
void Reflect(FieldVisitor& v) override;
|
|
void ImGuiInspector() override;
|
|
|
|
void SetTravelOffset(const glm::vec3& offset) { m_TravelOffset = offset; }
|
|
void SetTravelDuration(float seconds) { m_TravelDuration = seconds; }
|
|
void SetPauseDuration(float seconds) { m_PauseDuration = seconds; }
|
|
|
|
private:
|
|
[[nodiscard]] float GetTravelProgress() const;
|
|
[[nodiscard]] glm::vec3 GetOffsetAt(float progress) const;
|
|
|
|
glm::vec3 m_TravelOffset{8.0f, 0.0f, 0.0f};
|
|
float m_TravelDuration{4.0f};
|
|
float m_PauseDuration{1.0f};
|
|
|
|
float m_ElapsedTime{0.0f};
|
|
glm::vec3 m_StartPosition{0.0f};
|
|
bool m_Started{false};
|
|
};
|
|
|
|
#endif // LIGHTKEEPER_MOVINGPLATFORM_H
|