Co-authored-by: zzdxxz <2079238449@qq.com> Co-committed-by: zzdxxz <2079238449@qq.com>
51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace Data
|
|
{
|
|
public class PawnDef : Define
|
|
{
|
|
public string aiController;
|
|
public string texturePath = null;
|
|
public DrawingOrderDef
|
|
drawingOrder_down,
|
|
drawingOrder_up,
|
|
drawingOrder_left,
|
|
drawingOrder_right;
|
|
public DrawingOrderDef GetDrawingOrder(Orientation orientation)
|
|
{
|
|
// 定义一个临时变量用于存储结果
|
|
DrawingOrderDef result = null;
|
|
|
|
// 根据传入的 Orientation 获取对应的 DrawingOrderDef
|
|
switch (orientation)
|
|
{
|
|
case Orientation.Down:
|
|
result = drawingOrder_down;
|
|
break;
|
|
case Orientation.Up:
|
|
result = drawingOrder_up;
|
|
break;
|
|
case Orientation.Left:
|
|
result = drawingOrder_left;
|
|
break;
|
|
case Orientation.Right:
|
|
result = drawingOrder_right;
|
|
break;
|
|
default:
|
|
throw new ArgumentException("Invalid orientation value.");
|
|
}
|
|
|
|
// 如果当前方向的结果为空,则尝试用 drawingOrder_down 填充
|
|
if (result == null) result = drawingOrder_down;
|
|
|
|
// 如果 drawingOrder_down 仍然为空,则尝试用其他非空方向填充
|
|
if (result == null) result = drawingOrder_up ?? drawingOrder_left ?? drawingOrder_right;
|
|
|
|
return result;
|
|
}
|
|
}
|
|
public class MonsterDef:PawnDef
|
|
{
|
|
|
|
}
|
|
} |