space-game001/src/items/InteractiveObject.h
2026-04-11 16:18:59 +06:00

44 lines
940 B
C++

#pragma once
#include <string>
#include <memory>
#include <Eigen/Core>
#include "Item.h"
#include "render/Renderer.h"
namespace ZL {
struct Texture;
struct VertexRenderStruct;
class Renderer;
struct InteractiveObject {
std::string id;
std::string name;
Eigen::Vector3f position;
float interactionRadius;
std::shared_ptr<Texture> texture;
VertexRenderStruct mesh;
Item dropItem;
bool isActive = true;
bool isNpc = false;
std::string npcInteractCallback;
float walkSpeed = 1.5f;
float rotationSpeed = 8.0f;
float modelScale = 0.01f;
std::string animationIdlePath;
std::string animationWalkPath;
std::string texturePath;
std::string activateFunctionName;
InteractiveObject() : interactionRadius(2.0f) {}
bool isInRange(const Eigen::Vector3f& playerPos) const {
return (playerPos - position).norm() <= interactionRadius;
}
void draw(Renderer& renderer) const;
};
} // namespace ZL