diff --git a/Client/Assets/Resources/Prefab/Animation.prefab b/Client/Assets/Resources/Prefab/Animation.prefab index 5ee3c0a..0f51b4e 100644 --- a/Client/Assets/Resources/Prefab/Animation.prefab +++ b/Client/Assets/Resources/Prefab/Animation.prefab @@ -27,7 +27,7 @@ Transform: m_GameObject: {fileID: 5021031438404678310} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -6.6943, y: -0.3652, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Client/Assets/Resources/Prefab/Button3D.prefab b/Client/Assets/Resources/Prefab/Button3D.prefab index 2fc2756..4258aff 100644 --- a/Client/Assets/Resources/Prefab/Button3D.prefab +++ b/Client/Assets/Resources/Prefab/Button3D.prefab @@ -29,7 +29,7 @@ Transform: m_GameObject: {fileID: 2412502657045938467} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -13.67, y: -5.09, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: diff --git a/Client/Assets/Resources/Prefab/ButtonTemplate.prefab b/Client/Assets/Resources/Prefab/ButtonTemplate.prefab index eff2288..1d4f62b 100644 --- a/Client/Assets/Resources/Prefab/ButtonTemplate.prefab +++ b/Client/Assets/Resources/Prefab/ButtonTemplate.prefab @@ -37,7 +37,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -160.92151, y: -93.26492} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &6659858081700418582 diff --git a/Client/Assets/Resources/Prefab/Entity/EntityPrefab.prefab b/Client/Assets/Resources/Prefab/Entity/EntityPrefab.prefab index ebdbb2a..60cfcdb 100644 --- a/Client/Assets/Resources/Prefab/Entity/EntityPrefab.prefab +++ b/Client/Assets/Resources/Prefab/Entity/EntityPrefab.prefab @@ -124,6 +124,7 @@ Transform: - {fileID: 5549544358816209289} - {fileID: 1697214530303839877} - {fileID: 1404278780950315184} + - {fileID: 4504455988891581487} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &3332598847335032684 @@ -364,3 +365,65 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 605f185650fe46d89a6e0d60fb8fb11c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1001 &5211884413447499418 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 697189026367054479} + m_Modifications: + - target: {fileID: 5021031438404678310, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_Name + value: WeaponTexture + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} +--- !u!4 &4504455988891581487 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 8563418329714102965, guid: ea9af70ce0f4c8b4a9de58ac63074156, type: 3} + m_PrefabInstance: {fileID: 5211884413447499418} + m_PrefabAsset: {fileID: 0} diff --git a/Client/Assets/Resources/Prefab/Image.prefab b/Client/Assets/Resources/Prefab/Image.prefab index 88bd3ef..bba42ed 100644 --- a/Client/Assets/Resources/Prefab/Image.prefab +++ b/Client/Assets/Resources/Prefab/Image.prefab @@ -27,7 +27,7 @@ Transform: m_GameObject: {fileID: 5309816858037840717} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -5.781, y: -0.39, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Client/Assets/Resources/Prefab/RightMenu.prefab b/Client/Assets/Resources/Prefab/RightMenu.prefab index 7e343f7..534e09f 100644 --- a/Client/Assets/Resources/Prefab/RightMenu.prefab +++ b/Client/Assets/Resources/Prefab/RightMenu.prefab @@ -37,7 +37,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 342, y: -198} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.1, y: 0.9} --- !u!222 &6098472552964198111 diff --git a/Client/Assets/Resources/Prefab/TextTemplate.prefab b/Client/Assets/Resources/Prefab/TextTemplate.prefab index d2ebf03..77ae69a 100644 --- a/Client/Assets/Resources/Prefab/TextTemplate.prefab +++ b/Client/Assets/Resources/Prefab/TextTemplate.prefab @@ -35,7 +35,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -1.0921326, y: -54.256577} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 200, y: 14.01} m_Pivot: {x: 0.5, y: 1} --- !u!222 &6803973761688315705 diff --git a/Client/Assets/Scripts/Data/AttributesOffsetDef.cs b/Client/Assets/Scripts/Data/AttributesOffsetDef.cs new file mode 100644 index 0000000..be68d0a --- /dev/null +++ b/Client/Assets/Scripts/Data/AttributesOffsetDef.cs @@ -0,0 +1,124 @@ +using Entity; + +namespace Data +{ + public class AttributesOffsetDef : Define + { + // ====================================================================== + // 绝对值偏移 (Added/Subtracted directly) + // ====================================================================== + public float healthOffset = 0f; + public float moveSpeedOffset = 0f; + public float attackOffset = 0f; + public float defenseOffset = 0f; + public float attackSpeedOffset = 0f; + public float attackRangeOffset = 0f; + + public float attackTargetCountOffset = 0f; + + // ====================================================================== + // 百分比偏移 (Multiplied as a factor, e.g., 0.1 for +10%) + // ====================================================================== + // 注意:百分比偏移通常是乘法因子。 + // 0f 表示没有百分比变化,0.1f 表示增加10%,-0.1f 表示减少10%。 + // 应用时: baseValue * (1 + percentageOffset) + // 或者对于更直接的乘法,可以直接用 multiplyRatio,例如 1.1 表示增加 10%。 + public float healthPercentOffset = 0f; // 例如 0.1 表示 +10% + public float moveSpeedPercentOffset = 0f; + public float attackPercentOffset = 0f; + public float defensePercentOffset = 0f; + public float attackSpeedPercentOffset = 0f; + public float attackRangePercentOffset = 0f; + + public float attackTargetCountPercentOffset = 0f; + + // ====================================================================== + // 数组偏移 / 集合偏移 (更复杂的情况,如果原始属性是数组/集合) + // 因为你的Attributes类目前都是单一值,所以这里先按单一值处理。 + // 如果 future Attributes.attackTargets 变成 List 或者 int[], + // 这里就需要 List addedAttackTargets 或 List addedAttackTargetCounts + // 来表示要添加/移除的元素。 + // 示例:如果将来有一个属性是效果列表,这里可以定义要添加的效果 + // public List addedEffects = new List(); + // public List removedEffects = new List(); + // 如果 `attackTargetCount` 实际代表可以攻击的目标ID数组,那么: + // public List addedAttackTargets = new List(); + // public List removedAttackTargets = new List(); + // 注意:对于 `attackTargetCount` 来说,它本身是一个 int, + // 上面的 `attackTargetCountOffset` 已经足够处理“增加攻击目标数量”的需求。 + // "数组偏移"通常指的是当原始属性本身是一个集合时,你想要修改这个集合的元素。 + // 如果 `Attributes` 类保持其当前形式 (都是单一数值),那么不需要专门的数组偏移。 + // ====================================================================== + // 构造函数 (可选,用于方便初始化) + // ====================================================================== + public AttributesOffsetDef() + { + } + + // 可以添加带参数的构造函数,方便快速设置 + public AttributesOffsetDef(float healthAbs = 0f, float moveSpeedAbs = 0f, float attackAbs = 0f, + float defenseAbs = 0f, float attackSpeedAbs = 0f, float attackRangeAbs = 0f, + float attackTargetCountAbs = 0f, + float healthPct = 0f, float moveSpeedPct = 0f, float attackPct = 0f, + float defensePct = 0f, float attackSpeedPct = 0f, float attackRangePct = 0f, + float attackTargetCountPct = 0f) + { + healthOffset = healthAbs; + moveSpeedOffset = moveSpeedAbs; + attackOffset = attackAbs; + defenseOffset = defenseAbs; + attackSpeedOffset = attackSpeedAbs; + attackRangeOffset = attackRangeAbs; + attackTargetCountOffset = attackTargetCountAbs; + healthPercentOffset = healthPct; + moveSpeedPercentOffset = moveSpeedPct; + attackPercentOffset = attackPct; + defensePercentOffset = defensePct; + attackSpeedPercentOffset = attackSpeedPct; + attackRangePercentOffset = attackRangePct; + attackTargetCountPercentOffset = attackTargetCountPct; + } + + // ====================================================================== + // 应用偏移的方法 + // ====================================================================== + /// + /// 将此偏移应用到给定的Attributes实例上。 + /// + /// 要应用偏移的基础Attributes。 + /// 应用偏移后的新Attributes实例。 + public Attributes ApplyTo(Attributes baseAttributes) + { + // 创建一个新的Attributes实例以避免修改原始实例 + // 或者如果需要直接修改,可以返回 void + Attributes modifiedAttributes = new Attributes + { + health = baseAttributes.health, + moveSpeed = baseAttributes.moveSpeed, + attack = baseAttributes.attack, + defense = baseAttributes.defense, + attackSpeed = baseAttributes.attackSpeed, + attackRange = baseAttributes.attackRange, + attackTargetCount = baseAttributes.attackTargetCount + }; + // 首先应用百分比偏移 + modifiedAttributes.health = (int)(modifiedAttributes.health * (1f + healthPercentOffset)); + modifiedAttributes.moveSpeed *= (1f + moveSpeedPercentOffset); + modifiedAttributes.attack = (int)(modifiedAttributes.attack * (1f + attackPercentOffset)); + modifiedAttributes.defense = (int)(modifiedAttributes.defense * (1f + defensePercentOffset)); + modifiedAttributes.attackSpeed = (int)(modifiedAttributes.attackSpeed * (1f + attackSpeedPercentOffset)); + modifiedAttributes.attackRange = (int)(modifiedAttributes.attackRange * (1f + attackRangePercentOffset)); + modifiedAttributes.attackTargetCount = + (int)(modifiedAttributes.attackTargetCount * (1f + attackTargetCountPercentOffset)); + // 然后应用绝对值偏移 + modifiedAttributes.health += (int)healthOffset; + modifiedAttributes.moveSpeed += moveSpeedOffset; + modifiedAttributes.attack += (int)attackOffset; + modifiedAttributes.defense += (int)defenseOffset; + modifiedAttributes.attackSpeed += (int)attackSpeedOffset; + modifiedAttributes.attackRange += (int)attackRangeOffset; + modifiedAttributes.attackTargetCount += (int)attackTargetCountOffset; + return modifiedAttributes; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/AttributesOffsetDef.cs.meta b/Client/Assets/Scripts/Data/AttributesOffsetDef.cs.meta new file mode 100644 index 0000000..41c2a9a --- /dev/null +++ b/Client/Assets/Scripts/Data/AttributesOffsetDef.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fb6190c213d44e04946784c3a5063e83 +timeCreated: 1756302637 \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/DrawingOrderDef.cs b/Client/Assets/Scripts/Data/DrawingOrderDef.cs index ee4c5be..ab12300 100644 --- a/Client/Assets/Scripts/Data/DrawingOrderDef.cs +++ b/Client/Assets/Scripts/Data/DrawingOrderDef.cs @@ -231,7 +231,7 @@ namespace Data public List nodes = new(); public string nodeName; public Vector2 position = new(0, 0); - public float FPS = 0.5f; + public float FPS = 1f; public override bool Init(XElement xmlDef) { diff --git a/Client/Assets/Scripts/Data/FactionRequirementDef.cs b/Client/Assets/Scripts/Data/FactionRequirementDef.cs new file mode 100644 index 0000000..f839513 --- /dev/null +++ b/Client/Assets/Scripts/Data/FactionRequirementDef.cs @@ -0,0 +1,9 @@ +namespace Data +{ + public class FactionRequirementDef:Define + { + public string factionDefName; // 目标的派系DefName + public bool forAllPawnsInFaction = false; // 是否为该派系的所有Pawns添加Hediff + public int specificPawnCount = 1; // 如果不是所有Pawns,指定数量 + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/FactionRequirementDef.cs.meta b/Client/Assets/Scripts/Data/FactionRequirementDef.cs.meta new file mode 100644 index 0000000..0da962a --- /dev/null +++ b/Client/Assets/Scripts/Data/FactionRequirementDef.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d495178bf0c943fe9da8009592e20400 +timeCreated: 1756305417 \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/HediffCompDef.cs b/Client/Assets/Scripts/Data/HediffCompDef.cs new file mode 100644 index 0000000..66b187b --- /dev/null +++ b/Client/Assets/Scripts/Data/HediffCompDef.cs @@ -0,0 +1,17 @@ +using System; +using System.Xml.Linq; + +namespace Data +{ + public class HediffCompDef:Define + { + public Type compClass; + public override bool Init(XElement xmlDef) + { + base.Init(xmlDef); + var name = xmlDef.Attribute("class")?.Value??""; + compClass=Type.GetType(name); + return true; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/HediffCompDef.cs.meta b/Client/Assets/Scripts/Data/HediffCompDef.cs.meta new file mode 100644 index 0000000..56664f5 --- /dev/null +++ b/Client/Assets/Scripts/Data/HediffCompDef.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 92779af4b74648a99930c10376760af6 +timeCreated: 1756303386 \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/HediffDef.cs b/Client/Assets/Scripts/Data/HediffDef.cs new file mode 100644 index 0000000..aac66a6 --- /dev/null +++ b/Client/Assets/Scripts/Data/HediffDef.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Data +{ + public class HediffDef:Define + { + // 默认安装的身体部位 (例如 "Lung", "Heart") + public string defaultInstallPart = null; + // 是否阻止肺部疾病 (例如肺腐烂) + public bool preventsLungRot = false; + // Hediff的发展阶段列表 + public List stages = new List(); + // 附加的组件列表 + public List comps = new List(); + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/HediffDef.cs.meta b/Client/Assets/Scripts/Data/HediffDef.cs.meta new file mode 100644 index 0000000..9c662c1 --- /dev/null +++ b/Client/Assets/Scripts/Data/HediffDef.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a4311115be2f4da8a5a27e1bb298928e +timeCreated: 1756303757 \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/HediffStageDef.cs b/Client/Assets/Scripts/Data/HediffStageDef.cs new file mode 100644 index 0000000..0041de3 --- /dev/null +++ b/Client/Assets/Scripts/Data/HediffStageDef.cs @@ -0,0 +1,8 @@ +namespace Data +{ + public class HediffStageDef:Define + { + public float start; + public AffiliationDef attributesOffset = new(); + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/HediffStageDef.cs.meta b/Client/Assets/Scripts/Data/HediffStageDef.cs.meta new file mode 100644 index 0000000..728e8f6 --- /dev/null +++ b/Client/Assets/Scripts/Data/HediffStageDef.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 59d3b562e68e40fdaa65e5e6431c58e0 +timeCreated: 1756304101 \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/LocationRangeDef.cs b/Client/Assets/Scripts/Data/LocationRangeDef.cs new file mode 100644 index 0000000..624738d --- /dev/null +++ b/Client/Assets/Scripts/Data/LocationRangeDef.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Data +{ + public class LocationRangeDef:Define + { + public float minRadius = 0f; // 最小距离(以格数单位) + public float maxRadius = 10f; // 最大距离(以格数单位) + public int width = 5; // 宽度(以格数单位),指定一个方形区域 + public int height = 5; // 高度(以格数单位) + public bool allowNearWalls = true; // 是否允许靠近墙壁生成 + public bool allowSpawnOnPawn = false; // 是否允许直接生成在角色身上 + // 可以添加更多约束,如: + public List allowedTerrainTags; // 允许生成的地形标签 + } +} \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/LocationRangeDef.cs.meta b/Client/Assets/Scripts/Data/LocationRangeDef.cs.meta new file mode 100644 index 0000000..1a558f4 --- /dev/null +++ b/Client/Assets/Scripts/Data/LocationRangeDef.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9b4cf168bf1e41d4a63e78cb734453bd +timeCreated: 1756305435 \ No newline at end of file diff --git a/Client/Assets/Scripts/Entity/Character.cs b/Client/Assets/Scripts/Entity/Character.cs index fe13a37..3b44506 100644 --- a/Client/Assets/Scripts/Entity/Character.cs +++ b/Client/Assets/Scripts/Entity/Character.cs @@ -25,6 +25,7 @@ namespace Entity var maxIndex = Inventory != null && Inventory.Capacity > 0 ? Inventory.Capacity - 1 : 0; var clampedValue = Mathf.Clamp(value, 0, maxIndex); _currentSelected = clampedValue; + InitWeaponAnimator(); } } @@ -68,29 +69,6 @@ namespace Entity return remainingQuantity; } - // public override void TryAttack() - // { - // if (IsAttacking) - // return; - // if (!DefineManager.Instance.defines.TryGetValue(nameof(BulletDef), out var def)) - // return; - // // 修正:First() 可能会在一个空的 Values 集合上抛出异常。 - // // 更好的做法是使用 TryGetValue 或 FirstOrDefault 并检查结果。 - // // 这里假设至少有一个 BulletDef 存在,如果不是,需要更复杂的错误处理。 - // var bulletDefEntry = def.Values.FirstOrDefault(); - // if (bulletDefEntry == null) - // { - // Debug.LogError("No BulletDef found in DefineManager. Cannot attack."); - // return; - // } - // - // var bulletDef = (BulletDef)bulletDefEntry; - // - // Vector3 dir = MousePosition.GetWorldPosition(); - // EntityManage.Instance.GenerateBulletEntity(Program.Instance.FocusedDimensionId, bulletDef, Position, - // dir - Position, this); - // } - public override WeaponResource GetCurrentWeapon() { var currentSelectItem = Inventory.GetSlot(CurrentSelected); diff --git a/Client/Assets/Scripts/Entity/Entity.cs b/Client/Assets/Scripts/Entity/Entity.cs index d379824..8bbc5d9 100644 --- a/Client/Assets/Scripts/Entity/Entity.cs +++ b/Client/Assets/Scripts/Entity/Entity.cs @@ -32,6 +32,12 @@ namespace Entity public EntityPrefab entityPrefab; public EntityDef entityDef; + /// + /// 手上拿着显示的贴图 + /// + public GameObject weaponAnimator; + + public ITick[] weaponAnimatorNodeList; /// /// 人工智能行为树,定义实体的行为逻辑。 @@ -183,13 +189,32 @@ namespace Entity this.entityDef = entityDef; HideHealthBar(); + InitWeaponAnimator(); + } + + protected virtual void InitWeaponAnimator() + { + for (var i = 0; i < weaponAnimator.transform.childCount; i++) + { + Destroy(weaponAnimator.transform.GetChild(i).gameObject); + weaponAnimatorNodeList = null; + } + var weapon = GetCurrentWeapon(); + if (weapon == null) + { + weaponAnimator.SetActive(false); + return; + } + + var weaponAnimation = weapon.InstantiateAttackAnimation(weaponAnimator.transform); + weaponAnimatorNodeList = weaponAnimation.animationComponents; } /// /// 初始化实体的身体部分,包括不同朝向下的绘图节点。 /// /// 绘制顺序定义。 - public virtual void InitBody(DrawingOrderDef drawingOrder) + protected virtual void InitBody(DrawingOrderDef drawingOrder) { // 预缓存枚举值(避免每次循环重复调用 Enum.GetValues) var states = Enum.GetValues(typeof(EntityState)).Cast().ToArray(); @@ -295,7 +320,7 @@ namespace Entity /// 绘图节点定义。 /// 父节点对象。 /// 创建的GameObject,如果失败则返回null - public virtual GameObject InitBodyPart(DrawNodeDef drawNode, GameObject parent) + protected virtual GameObject InitBodyPart(DrawNodeDef drawNode, GameObject parent) { try { @@ -470,6 +495,13 @@ namespace Entity } } + if (weaponAnimatorNodeList != null) + { + foreach (var tick in weaponAnimatorNodeList) + { + tick.Tick(); + } + } if (IsShowingHealthBarUI) { _hitBarUIShowTimer -= Time.deltaTime;