From b1c0d3262972b8cc32441053e6183827cbb3fb7b Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 15 十月 2025 16:16:12 +0800
Subject: [PATCH] 125 战斗 角色身上的buff特效要绑人物中心点(hit挂载点上),否者人物跳跃动作时会特效会脱离,特效配置上有一个绑定骨骼字段,需支持hit点(Buff特效)
---
Main/System/Battle/Motion/MotionBase.cs | 2 +-
Main/System/Battle/Buff/BattleObjectBuffMgr.cs | 14 ++++++++++++--
Main/Component/UI/Effect/BattleEffectPlayer.cs | 28 ++++++++++++++++++++++++++++
3 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/Main/Component/UI/Effect/BattleEffectPlayer.cs b/Main/Component/UI/Effect/BattleEffectPlayer.cs
index 09a6e93..d740f15 100644
--- a/Main/Component/UI/Effect/BattleEffectPlayer.cs
+++ b/Main/Component/UI/Effect/BattleEffectPlayer.cs
@@ -30,6 +30,8 @@
}
}
+ public bool isBindBone = false;
+
public bool isRedCamp = true;
public EffectConfig effectConfig;
@@ -625,4 +627,30 @@
animator.speed = speedRate;
}
}
+
+ public void BindBone(SkeletonAnimation skeletonAnim, string v)
+ {
+ Bone bone = skeletonAnim.skeleton.FindBone(v);
+
+ if (null == bone)
+ {
+ return;
+ }
+
+ isBindBone = true;
+
+ BoneFollower boneFollower = gameObject.AddMissingComponent<BoneFollower>();
+ boneFollower.boneName = v;
+ boneFollower.skeletonRenderer = skeletonAnim;
+
+ boneFollower.followBoneRotation = false;
+ boneFollower.followXYPosition = true;
+ boneFollower.followZPosition = false;
+ boneFollower.followLocalScale = false;
+ boneFollower.followParentWorldScale = false;
+ boneFollower.followSkeletonFlip = false;
+
+ boneFollower.Initialize();
+ boneFollower.LateUpdate();
+ }
}
diff --git a/Main/System/Battle/Buff/BattleObjectBuffMgr.cs b/Main/System/Battle/Buff/BattleObjectBuffMgr.cs
index e221da3..104fbcf 100644
--- a/Main/System/Battle/Buff/BattleObjectBuffMgr.cs
+++ b/Main/System/Battle/Buff/BattleObjectBuffMgr.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Spine.Unity;
using UnityEngine;
@@ -31,6 +32,10 @@
BattleEffectPlayer effectPlayer = kv.Value.Key;
if (null != effectPlayer)
{
+ if (effectPlayer.isBindBone)
+ {
+ continue;
+ }
effectPlayer.transform.position = battleObject.heroRectTrans.position;
var effectPos = effectPlayer.effectConfig.effectPos;
if (null != effectPos && effectPos.Length >= 2)
@@ -113,14 +118,14 @@
return;
}
- bool isNew = false;
+ // bool isNew = false;
if (buffDataDict.ContainsKey(vNetData.BuffID))
{
buffDataDict[vNetData.BuffID] = vNetData;
}
else
{
- isNew = true;
+ // isNew = true;
buffDataDict.Add(vNetData.BuffID, vNetData);
}
@@ -138,6 +143,11 @@
else
{
BattleEffectPlayer effect = battleObject.battleField.battleEffectMgr.PlayEffect(battleObject, skillConfig.BuffEffect, battleObject.heroRectTrans, battleObject.Camp);
+
+ BoneFollower boneFollower = effect.AddMissingComponent<BoneFollower>();
+
+ effect.BindBone(battleObject.motionBase.skeletonAnim, "hit");
+
HashSet<uint> buffIdSet = new HashSet<uint>();
buffIdSet.Add(vNetData.BuffID);
buffEffectDict.Add(skillConfig.BuffEffect, new KeyValuePair<BattleEffectPlayer, HashSet<uint>>(effect, buffIdSet));
diff --git a/Main/System/Battle/Motion/MotionBase.cs b/Main/System/Battle/Motion/MotionBase.cs
index 4502828..304d99e 100644
--- a/Main/System/Battle/Motion/MotionBase.cs
+++ b/Main/System/Battle/Motion/MotionBase.cs
@@ -18,7 +18,7 @@
public Action OnHitAnimationComplete;
private List<Action> runningActions = new List<Action>();
- protected SkeletonAnimation skeletonAnim;
+ public SkeletonAnimation skeletonAnim;
protected Spine.AnimationState animState;
protected Spine.Skeleton skeleton;
protected float defaultMixDuration = 0f;
--
Gitblit v1.8.0