DESKTOP-BGJIU14\ck vor 5 Monaten
Ursprung
Commit
dbc3e5807e

+ 10 - 2
Assets/Scripts/GameLogic/Combat/Hero/CombatHeroHitPoint.cs

@@ -45,6 +45,7 @@ namespace GameLogic.Combat.Hero
                 SpecialDotInfo specialDotInfo = new SpecialDotInfo();
                 specialDotInfo.dotName = specialDotMono.DotName;
                 specialDotInfo.targetTran = specialDotMono.transform;
+                specialDotInfo.followSkeleton = specialDotMono.followSkeleton;
                 specialDotInfo.heroEntity = combatHeroEntity;
                 allSpecialDotInfo.Add(specialDotInfo);
             }
@@ -56,14 +57,21 @@ namespace GameLogic.Combat.Hero
 
         public SpecialDotInfo GetSpecialDotInfo(string specialDotName)
         {
+            SpecialDotInfo specialDotInfo = MinSpecialDotInfo;
             for (int i = 0; i < allSpecialDotInfo.Count; i++)
             {
                 if (allSpecialDotInfo[i].dotName == specialDotName)
                 {
-                    return allSpecialDotInfo[i];
+                    specialDotInfo = allSpecialDotInfo[i];
                 }
             }
-            return MinSpecialDotInfo;
+
+            if (specialDotInfo.followSkeleton)
+            {
+                combatHeroEntity.combatHeroAnimtion.SetSpecialDotMonoFollow(specialDotInfo);
+            }
+
+            return specialDotInfo;
         }
     }
 }

+ 24 - 2
Assets/Scripts/GameLogic/Combat/Hero/HeroAanimtion/CombatHeroGPUAnimtion.cs

@@ -1,5 +1,8 @@
-using GameLogic.Combat.Hero.HeroGPU;
+using System.Collections.Generic;
+using GameLogic.Combat.Hero.HeroGPU;
+using GameTimeLine.CustomizeTimeLogic;
 using GPUECSAnimationBaker.Engine.AnimatorSystem;
+using UnityEngine;
 
 namespace GameLogic.Combat.Hero
 {
@@ -12,10 +15,14 @@ namespace GameLogic.Combat.Hero
         private HeroGPUAnimtionStateInfo _heroPlayStateInfoBasic;
 
         protected HeroGPUMono _heroGPUMono;
+        private List<string> _anchorNames = new List<string>();
+
         protected override void ProInit()
         {
-            GpuEcsAnimatorBehaviour = combatHeroEntity.GameObject.transform.GetComponentInChildren<GpuEcsAnimatorBehaviour>();
+            GpuEcsAnimatorBehaviour =
+                combatHeroEntity.GameObject.transform.GetComponentInChildren<GpuEcsAnimatorBehaviour>();
             animations = GpuEcsAnimatorBehaviour.animations;
+            _anchorNames = GpuEcsAnimatorBehaviour.anchorNames;
             GPUAnimtion = new GPUAnimtion();
             GPUAnimtion.Init(GpuEcsAnimatorBehaviour);
             _heroPlayStateInfoBasic = new HeroGPUAnimtionStateInfo();
@@ -28,6 +35,21 @@ namespace GameLogic.Combat.Hero
             _heroGPUMono.animtionState = GPUAnimtion.gpuEcsAnimatorShaderData.shaderData;
         }
 
+        public override void SetSpecialDotMonoFollow(SpecialDotInfo specialDotInfo)
+        {
+            if (!specialDotInfo.followSkeleton)
+            {
+                return;
+            }
+
+            int index = _anchorNames.IndexOf(specialDotInfo.dotName);
+            if (index >= 0)
+            {
+                GPUAnimtion.GetGPUAnchors(index, out Vector3 pos, out Quaternion unityQuaternion);
+                specialDotInfo.targetTran.localPosition = pos;
+            }
+        }
+
         private int GetAnimtionIndex(string name)
         {
             for (int i = 0; i < animations.Length; i++)

+ 6 - 0
Assets/Scripts/GameLogic/Combat/Hero/HeroAanimtion/HeroAnimtionBasic.cs

@@ -1,4 +1,5 @@
 using System;
+using GameTimeLine.CustomizeTimeLogic;
 
 namespace GameLogic.Combat.Hero
 {
@@ -6,6 +7,11 @@ namespace GameLogic.Combat.Hero
     {
         protected CombatHeroEntity combatHeroEntity;
 
+        public virtual void SetSpecialDotMonoFollow(SpecialDotInfo specialDotInfo)
+        {
+            
+        }
+
         public void Init(CombatHeroEntity combatHeroEntity)
         {
             this.combatHeroEntity = combatHeroEntity;

+ 2 - 0
Assets/Scripts/GameTimeLine/CustomizeTimeLogic/SpecialDotInfo.cs

@@ -7,9 +7,11 @@ using UnityEngine;
 public class SpecialDotInfo
 {
     public string dotName;
+
     public ITimeLineSpecialDotPos heroEntity;
 
     public Transform targetTran;
+    public bool followSkeleton;
     
     public void Dis()
     {

+ 1 - 0
Assets/Scripts/GameTimeLine/CustomizeTimeLogic/SpecialDotMono.cs

@@ -7,6 +7,7 @@ namespace GameTimeLine.CustomizeTimeLogic
     {
         public string DotName;
         public bool followSkeleton;
+        
         // public string followSkeleton
         public string GetSkeletonName()
         {