mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 为 Position 结构体添加 StructLayout 特性以确保顺序布局 - 为 Velocity 结构体添加 StructLayout 特性以确保顺序布局 - 更新 Velocity 组件的 XML 文档注释,提供更详细的描述 - 优化 Velocity 组件属性的文档注释,明确单位信息 - 添加 System.Runtime.InteropServices 命名空间引用
22 lines
564 B
C#
22 lines
564 B
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace GFramework.Core.ecs.components;
|
|
|
|
/// <summary>
|
|
/// 位置组件,用于表示实体在二维空间中的坐标位置。
|
|
/// </summary>
|
|
/// <param name="x">X轴坐标值</param>
|
|
/// <param name="y">Y轴坐标值</param>
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public struct Position(float x, float y)
|
|
{
|
|
/// <summary>
|
|
/// 获取X轴坐标值。
|
|
/// </summary>
|
|
public float X { get; set; } = x;
|
|
|
|
/// <summary>
|
|
/// 获取Y轴坐标值。
|
|
/// </summary>
|
|
public float Y { get; set; } = y;
|
|
} |