(client) feat:实现血条显示,实现攻击交互,添加碰撞体;fix:修复部分朝向贴图加载失败的问题;chore:规范工作类和行为获取类命名
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user