实现NPC系统的核心功能,包括: 1. 新增NpcDataLoader用于加载NPC索引和配置数据 2. 添加NpcAnimation处理NPC动画显示 3. 创建NpcObject实现NPC交互和显示逻辑 4. 在GameMapTestScene中集成测试NPC功能
26 lines
659 B
C++
26 lines
659 B
C++
#pragma once
|
|
|
|
#include "npc/NpcDataLoader.h"
|
|
#include <frostbite2D/2d/actor.h>
|
|
#include <frostbite2D/animation/animation.h>
|
|
#include <string>
|
|
|
|
namespace frostbite2D {
|
|
|
|
class NpcAnimation : public Actor {
|
|
public:
|
|
bool Init(const npc::NpcConfig& config);
|
|
void SetDirection(int direction);
|
|
bool IsReady() const { return displayAnimation_ != nullptr; }
|
|
bool IsAnimationFinished() const;
|
|
const std::string& GetAnimationPath() const { return animationPath_; }
|
|
bool GetDisplayLocalBounds(Rect& outBounds) const;
|
|
|
|
private:
|
|
RefPtr<Animation> displayAnimation_ = nullptr;
|
|
std::string animationPath_;
|
|
int direction_ = 1;
|
|
};
|
|
|
|
} // namespace frostbite2D
|