feat: 添加游戏数学工具类并重构相关代码
refactor: 将数学工具函数移至GameMath类 feat(音频): 实现地图音频控制器 feat(调试): 添加游戏调试UI组件 feat(地图): 增加移动区域边界获取方法 fix(角色): 修复角色移动区域抑制逻辑 refactor(世界): 重构游戏世界场景初始化 docs(音频): 完善音频数据库注释
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/math/GameMath.h"
|
||||
#include <frostbite2D/types/type_math.h>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@@ -81,8 +82,8 @@ struct CharacterMotor {
|
||||
float gravity = 1600.0f;
|
||||
|
||||
void SetGroundPosition(const Vec2& groundPosition) {
|
||||
position.x = RoundWorldCoordinate(groundPosition.x);
|
||||
position.y = RoundWorldCoordinate(groundPosition.y);
|
||||
position.x = gameMath::RoundWorldCoordinate(groundPosition.x);
|
||||
position.y = gameMath::RoundWorldCoordinate(groundPosition.y);
|
||||
positionRemainder_ = Vec2::Zero();
|
||||
}
|
||||
|
||||
@@ -167,10 +168,6 @@ struct CharacterMotor {
|
||||
}
|
||||
|
||||
private:
|
||||
static int32 RoundWorldCoordinate(float value) {
|
||||
return static_cast<int32>(std::lround(value));
|
||||
}
|
||||
|
||||
static int32 ConsumeWholeUnits(float& remainder) {
|
||||
if (remainder >= 1.0f) {
|
||||
int32 wholeUnits = static_cast<int32>(std::floor(remainder));
|
||||
|
||||
Reference in New Issue
Block a user