mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
refactor(ecs): 优化位置和速度组件的内存布局
- 为 Position 结构体添加 StructLayout 特性以确保顺序布局 - 为 Velocity 结构体添加 StructLayout 特性以确保顺序布局 - 更新 Velocity 组件的 XML 文档注释,提供更详细的描述 - 优化 Velocity 组件属性的文档注释,明确单位信息 - 添加 System.Runtime.InteropServices 命名空间引用
This commit is contained in:
parent
d7bd9fc569
commit
40ba109671
@ -1,3 +1,5 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace GFramework.Core.ecs.components;
|
||||
|
||||
/// <summary>
|
||||
@ -5,6 +7,7 @@ namespace GFramework.Core.ecs.components;
|
||||
/// </summary>
|
||||
/// <param name="x">X轴坐标值</param>
|
||||
/// <param name="y">Y轴坐标值</param>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Position(float x, float y)
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -1,19 +1,21 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace GFramework.Core.ecs.components;
|
||||
|
||||
/// <summary>
|
||||
/// 速度组件,用于表示实体在二维空间中的运动速度。
|
||||
/// 速度结构体,用于表示二维空间中实体的瞬时速度向量
|
||||
/// 包含X轴和Y轴的速度分量,通常用于物理计算和运动系统
|
||||
/// </summary>
|
||||
/// <param name="x">X轴方向的速度分量</param>
|
||||
/// <param name="y">Y轴方向的速度分量</param>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Velocity(float x, float y)
|
||||
{
|
||||
/// <summary>
|
||||
/// X轴方向的速度分量
|
||||
/// X轴速度分量,单位为距离单位/秒
|
||||
/// </summary>
|
||||
public float X { get; set; } = x;
|
||||
|
||||
/// <summary>
|
||||
/// Y轴方向的速度分量
|
||||
/// Y轴速度分量,单位为距离单位/秒
|
||||
/// </summary>
|
||||
public float Y { get; set; } = y;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user