实现游戏基础架构,包含以下主要功能: - 地图系统:支持地图加载、图层管理和相机控制 - 角色系统:实现角色装备、动画和行为管理 - 场景系统:提供测试场景和世界场景切换 - 世界管理:处理城镇和区域切换逻辑 - 数据加载:添加角色和装备配置加载器 这些改动为游戏开发奠定了基础框架,支持后续功能扩展
45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "character/CharacterDataLoader.h"
|
|
#include "character/CharacterEquipmentManager.h"
|
|
#include <frostbite2D/2d/actor.h>
|
|
#include <frostbite2D/animation/animation.h>
|
|
#include <frostbite2D/base/RefPtr.h>
|
|
#include <map>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace frostbite2D {
|
|
|
|
class CharacterObject;
|
|
|
|
class CharacterAnimation : public Actor {
|
|
public:
|
|
using ActionAnimationList = std::map<std::string, std::vector<RefPtr<Animation>>>;
|
|
|
|
bool Init(CharacterObject* parent,
|
|
const character::CharacterConfig& config,
|
|
const CharacterEquipmentManager& equipmentManager);
|
|
|
|
void SetAction(const std::string& actionName);
|
|
void SetDirection(int direction);
|
|
const std::string& GetCurrentAction() const { return currentActionTag_; }
|
|
|
|
private:
|
|
static std::string FormatImgPath(std::string path, Animation::ReplaceData data);
|
|
|
|
void CreateAnimationBySlot(const std::string& actionName,
|
|
const std::string& slotName,
|
|
const std::string& actionPath,
|
|
const character::CharacterConfig& config,
|
|
const CharacterEquipmentManager& equipmentManager);
|
|
void ApplyFlipRecursive(Actor* actor, bool flipped) const;
|
|
|
|
CharacterObject* parent_ = nullptr;
|
|
ActionAnimationList actionAnimations_;
|
|
std::string currentActionTag_;
|
|
int direction_ = 1;
|
|
};
|
|
|
|
} // namespace frostbite2D
|