diff --git a/GFramework.Core/ecs/components/Position.cs b/GFramework.Core/ecs/components/Position.cs index 472679f..204f66d 100644 --- a/GFramework.Core/ecs/components/Position.cs +++ b/GFramework.Core/ecs/components/Position.cs @@ -1,3 +1,5 @@ +using System.Runtime.InteropServices; + namespace GFramework.Core.ecs.components; /// @@ -5,6 +7,7 @@ namespace GFramework.Core.ecs.components; /// /// X轴坐标值 /// Y轴坐标值 +[StructLayout(LayoutKind.Sequential)] public struct Position(float x, float y) { /// diff --git a/GFramework.Core/ecs/components/Velocity.cs b/GFramework.Core/ecs/components/Velocity.cs index 51e8892..26465b2 100644 --- a/GFramework.Core/ecs/components/Velocity.cs +++ b/GFramework.Core/ecs/components/Velocity.cs @@ -1,19 +1,21 @@ +using System.Runtime.InteropServices; + namespace GFramework.Core.ecs.components; /// -/// 速度组件,用于表示实体在二维空间中的运动速度。 +/// 速度结构体,用于表示二维空间中实体的瞬时速度向量 +/// 包含X轴和Y轴的速度分量,通常用于物理计算和运动系统 /// -/// X轴方向的速度分量 -/// Y轴方向的速度分量 +[StructLayout(LayoutKind.Sequential)] public struct Velocity(float x, float y) { /// - /// X轴方向的速度分量 + /// X轴速度分量,单位为距离单位/秒 /// public float X { get; set; } = x; /// - /// Y轴方向的速度分量 + /// Y轴速度分量,单位为距离单位/秒 /// public float Y { get; set; } = y; } \ No newline at end of file