feat(npc): 添加NPC数据加载、动画和对象功能
实现NPC系统的核心功能,包括: 1. 新增NpcDataLoader用于加载NPC索引和配置数据 2. 添加NpcAnimation处理NPC动画显示 3. 创建NpcObject实现NPC交互和显示逻辑 4. 在GameMapTestScene中集成测试NPC功能
This commit is contained in:
25
Game/include/npc/NpcAnimation.h
Normal file
25
Game/include/npc/NpcAnimation.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user