(client)feat:实现子弹定义以及生成,实现初始化动画,实现血条 (#43)

Co-authored-by: zzdxxz <2079238449@qq.com>
Co-committed-by: zzdxxz <2079238449@qq.com>
This commit is contained in:
2025-08-19 20:22:10 +08:00
committed by TheRedApricot
parent 670f778eee
commit d91210a6ff
119 changed files with 4797 additions and 2929 deletions

View File

@ -26,37 +26,63 @@ namespace Data
public DrawNodeDef drawingOrder_left;
public DrawNodeDef drawingOrder_right;
public string texturePath;
public int pixelsPerUnit = 16;
public float pixelsPerUnit = 16;
public DrawNodeDef GetDrawingOrder(Orientation orientation)
public DrawNodeDef GetDrawingOrder(Orientation orientation, out Orientation sourceOrientation)
{
// 定义一个临时变量用于存储结果
DrawNodeDef result = null;
// 初始化 sourceOrientation 为默认值
sourceOrientation = Orientation.Down;
// 根据传入的 Orientation 获取对应的 DrawingOrderDef
switch (orientation)
{
case Orientation.Down:
result = drawingOrder_down;
sourceOrientation = Orientation.Down;
break;
case Orientation.Up:
result = drawingOrder_up;
sourceOrientation = Orientation.Up;
break;
case Orientation.Left:
result = drawingOrder_left;
sourceOrientation = Orientation.Left;
break;
case Orientation.Right:
result = drawingOrder_right;
sourceOrientation = Orientation.Right;
break;
default:
throw new ArgumentException("Invalid orientation value.");
}
// 如果当前方向的结果为空,则尝试用 drawingOrder_down 填充
if (result == null) result = drawingOrder_down;
if (result == null)
{
result = drawingOrder_down;
sourceOrientation = Orientation.Down; // 更新 sourceOrientation
}
// 如果 drawingOrder_down 仍然为空,则尝试用其他非空方向填充
if (result == null) result = drawingOrder_up ?? drawingOrder_left ?? drawingOrder_right;
if (result != null) return result;
if (drawingOrder_up != null)
{
result = drawingOrder_up;
sourceOrientation = Orientation.Up; // 更新 sourceOrientation
}
else if (drawingOrder_left != null)
{
result = drawingOrder_left;
sourceOrientation = Orientation.Left; // 更新 sourceOrientation
}
else if (drawingOrder_right != null)
{
result = drawingOrder_right;
sourceOrientation = Orientation.Right; // 更新 sourceOrientation
}
return result;
}