(client) feat:实现血条显示,实现攻击交互,添加碰撞体;fix:修复部分朝向贴图加载失败的问题;chore:规范工作类和行为获取类命名

This commit is contained in:
m0_75251201
2025-08-13 22:53:57 +08:00
parent 9922f06990
commit 35924f3695
37 changed files with 1006 additions and 183 deletions

View File

@ -1,7 +1,18 @@
using System.Collections.Generic;
namespace Data
{
public enum Relation
{
Neutral,
Hostile,
Friendly,
}
public class AffiliationDef : Define
{
public Relation defaultRelation = Relation.Neutral;
public List<string> hostileFactions;
public List<string> neutralFactions;
public List<string> friendlyFactions;
}
}

View File

@ -7,7 +7,7 @@ namespace Data
public class BehaviorTreeDef : Define
{
public BehaviorTreeDef[] childTree;
public string className="Selector";
public string className= "ThinkNode_Selector";
public string value;

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;
}

View File

@ -1,13 +1,23 @@
namespace Data
{
public enum ItemRarity
{
Common,
Uncommon,
Rare,
Epic,
Legendary
}
public class ItemDef:Define
{
public ImageDef texture;
public AttributesDef attributes;
public ItemRarity rarity = ItemRarity.Common;
public int maxStack = 1; // 最大堆叠数量默认为1
public bool ssEquippable = false; // 是否可装备
}
public class WeaponDef : ItemDef
{
public AttributesDef attributes;
}
}

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Xml.Linq;
using UnityEngine.Tilemaps;
namespace Data
{
@ -7,6 +8,7 @@ namespace Data
{
public ImageDef texture;
public string name = "";
public Tile.ColliderType collider = Tile.ColliderType.None;
public override bool Init(XElement xmlDef)
{