feat(animation): 添加动画状态回调支持

refactor(character): 重构角色动作处理逻辑

feat(swordman): 实现剑士基础攻击和技能1处理

refactor(state): 优化状态机与动作上下文管理

feat(input): 改进输入系统支持动作请求队列

refactor(movement): 重构移动系统支持行走/奔跑模式
This commit is contained in:
2026-04-04 14:45:41 +08:00
parent 1200cf0181
commit 5e80df040b
29 changed files with 1251 additions and 513 deletions

View File

@@ -3,6 +3,9 @@
#include "character/CharacterActionTypes.h"
#include <frostbite2D/event/joystick_event.h>
#include <frostbite2D/event/key_event.h>
#include <cstdint>
#include <string>
#include <vector>
namespace frostbite2D {
@@ -19,14 +22,31 @@ public:
void ClearFrameState();
private:
enum class KeyboardMoveDirection {
None,
Left,
Right,
Up,
Down,
};
void QueueAction(const std::string& actionId);
bool IsDirectionPressed(KeyboardMoveDirection direction) const;
bool HasDirectionalInput() const;
void RefreshKeyboardMoveMode();
bool left_ = false;
bool right_ = false;
bool up_ = false;
bool down_ = false;
bool jumpPressed_ = false;
bool attackPressed_ = false;
bool skill1Pressed_ = false;
bool dashPressed_ = false;
std::vector<std::string> actionRequests_;
CharacterMoveMode keyboardMoveMode_ = CharacterMoveMode::None;
KeyboardMoveDirection runDirection_ = KeyboardMoveDirection::None;
std::uint32_t leftLastTapTimestamp_ = 0;
std::uint32_t rightLastTapTimestamp_ = 0;
std::uint32_t upLastTapTimestamp_ = 0;
std::uint32_t downLastTapTimestamp_ = 0;
float leftStickX_ = 0.0f;
float leftStickY_ = 0.0f;
float joystickDeadZone_ = 0.2f;