DESKTOP-FB72PO8\Administrator 1 päivä sitten
vanhempi
commit
035553f650

+ 37 - 4
Assets/Res/CombatScenes/CombatRoot.prefab

@@ -29,13 +29,13 @@ Transform:
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 65994213146227239}
   serializedVersion: 2
-  m_LocalRotation: {x: 0.17364816, y: 0, z: 0, w: 0.9848078}
-  m_LocalPosition: {x: -0, y: -3, z: -0.7}
+  m_LocalRotation: {x: 0.17364816, y: -0, z: -0, w: 0.9848078}
+  m_LocalPosition: {x: 0, y: -3, z: -0.70000076}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
   - {fileID: 4445399462343019278}
-  m_Father: {fileID: 5344611500333309412}
+  m_Father: {fileID: 5999369449934832163}
   m_LocalEulerAnglesHint: {x: 20, y: 0, z: 0}
 --- !u!20 &5136129069556543016
 Camera:
@@ -186,7 +186,7 @@ Transform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
-  - {fileID: 6818137407374040233}
+  - {fileID: 5999369449934832163}
   m_Father: {fileID: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!114 &7261115989929743686
@@ -205,6 +205,39 @@ MonoBehaviour:
   TraumaExponent: 1
   MaximumAngularShake: {x: 5, y: 5, z: 5}
   MaximumTranslationShake: {x: 0.75, y: 0.75, z: 0.75}
+--- !u!1 &8008758086050486737
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 7
+  m_Component:
+  - component: {fileID: 5999369449934832163}
+  m_Layer: 0
+  m_HasEditorInfo: 1
+  m_Name: root2
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &5999369449934832163
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8008758086050486737}
+  serializedVersion: 2
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children:
+  - {fileID: 6818137407374040233}
+  m_Father: {fileID: 5344611500333309412}
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &9046924969066059369
 GameObject:
   m_ObjectHideFlags: 0

+ 62 - 0
Assets/Scenes/testCombat.scene

@@ -252,6 +252,67 @@ Transform:
   - {fileID: 1515802678}
   m_Father: {fileID: 1902930422}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1001 &59330909
+PrefabInstance:
+  m_ObjectHideFlags: 0
+  serializedVersion: 2
+  m_Modification:
+    serializedVersion: 3
+    m_TransformParent: {fileID: 0}
+    m_Modifications:
+    - target: {fileID: 4286731389157393447, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_Name
+      value: CombatRoot (3)
+      objectReference: {fileID: 0}
+    - target: {fileID: 4286731389157393447, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_IsActive
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 24.1
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: 25
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: 25.6
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalRotation.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalRotation.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalRotation.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 5344611500333309412, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.z
+      value: 0
+      objectReference: {fileID: 0}
+    m_RemovedComponents: []
+    m_RemovedGameObjects: []
+    m_AddedGameObjects: []
+    m_AddedComponents: []
+  m_SourcePrefab: {fileID: 100100000, guid: fb39a21bdd72eae46936ffaebc380841, type: 3}
 --- !u!213 &77953616
 Sprite:
   m_ObjectHideFlags: 0
@@ -13253,3 +13314,4 @@ SceneRoots:
   - {fileID: 1544803331}
   - {fileID: 1085826000}
   - {fileID: 667277092}
+  - {fileID: 59330909}

+ 48 - 7
Assets/Scripts/GameLogic/Combat/CombatTool/CombatCameraControllder.cs

@@ -11,6 +11,7 @@ namespace GameLogic.Combat.CombatTool
     public class CombatCameraControllder : IDisposable, ICameraShaking
     {
         public Transform root;
+        public Transform root2;
         public Camera Camera;
         public CombatController combatController;
         public StressReceiver StressReceiver;
@@ -43,7 +44,8 @@ namespace GameLogic.Combat.CombatTool
             CombatEventManager.Instance.AddEventListener(CombatEventType.SencenBesselPathAlter, SencenBesselPathAlter);
             this.combatController = combatController;
             Camera = camera;
-            root = Camera.transform.parent;
+            root2 = Camera.transform.parent;
+            root = Camera.transform.parent.parent;
             StressReceiver = camera.transform.GetComponentInParent<StressReceiver>();
             TimeLineSingletonEventManager.Instance.AddTimeLineBasic(this);
             EventManager.Instance.AddEventListener(CustomEventType.HeroClick, HeroClick);
@@ -99,9 +101,9 @@ namespace GameLogic.Combat.CombatTool
             isStartShake = false;
         }
 
-        public void SetFieldOfView(float fieldOfView,float speed)
+        public void SetFieldOfView(float fieldOfView, float speed)
         {
-            FieldOfViewSpeed=speed;
+            FieldOfViewSpeed = speed;
             FieldOfViewTime = 0;
             FieldOfViewStartValue = Camera.fieldOfView;
             FieldOfViewTargetValue = fieldOfView;
@@ -110,10 +112,9 @@ namespace GameLogic.Combat.CombatTool
 
         public void Update(float t)
         {
-
             if (isUpdateFieldOfView)
             {
-                FieldOfViewTime += t*FieldOfViewSpeed;
+                FieldOfViewTime += t * FieldOfViewSpeed;
                 Camera.fieldOfView = Mathf.Lerp(FieldOfViewStartValue, FieldOfViewTargetValue, FieldOfViewTime);
                 if (FieldOfViewTime >= 1)
                 {
@@ -121,19 +122,59 @@ namespace GameLogic.Combat.CombatTool
                 }
             }
 
+            CombatHeroEntity combatHeroEntities = combatController.playerHeroEntity;
             if (!isStartShake && !isStop)
             {
-                CombatHeroEntity combatHeroEntities = combatController.playerHeroEntity;
                 if (combatHeroEntities == null)
                 {
                     return;
                 }
 
-                Vector3 p = combatHeroEntities.GameObject.transform.TransformPoint(new Vector3(0, 8, -10));
+                Vector3 dir = combatHeroEntities.faceDir;
+                // CombatHeroEntity foucusTarget = combatHeroEntities.CombatAIBasic.currFocusTarget as CombatHeroEntity;
+                // if (foucusTarget != null)
+                // {
+                //     dir = foucusTarget.dotPos - combatHeroEntities.dotPos;
+                //     dir = dir.normalized;
+                // }
+
+                Quaternion q = Quaternion.LookRotation(dir);
+                Vector3 myHeroTarget = new Vector3(0, 8, -10);
+                myHeroTarget = q * myHeroTarget;
+                Vector3 p = combatHeroEntities.GameObject.transform.TransformPoint(myHeroTarget);
                 root.rotation = Quaternion.Lerp(root.rotation, combatHeroEntities.GameObject.transform.rotation,
                     1);
                 root.position = Vector3.Lerp(root.position, p, 1);
             }
+
+            // MoveRoot2();
+        }
+
+        private void MoveRoot2()
+        {
+            CombatHeroEntity combatHeroEntities = combatController.playerHeroEntity;
+
+            if (combatHeroEntities == null)
+            {
+                return;
+            }
+
+            Vector3 dir = combatHeroEntities.faceDir;
+            CombatHeroEntity foucusTarget = combatHeroEntities.CombatAIBasic.currFocusTarget as CombatHeroEntity;
+            if (foucusTarget != null)
+            {
+                dir = foucusTarget.dotPos - combatHeroEntities.dotPos;
+                dir = dir.normalized;
+            }
+
+            Quaternion q = Quaternion.LookRotation(dir);
+            Vector3 myHeroTarget = new Vector3(0, 8, -10);
+            myHeroTarget = q * myHeroTarget;
+            Vector3 p = combatHeroEntities.GameObject.transform.TransformPoint(myHeroTarget);
+            Vector3 newP = p - root.position;
+            root2.rotation = Quaternion.Lerp(root2.rotation, q,
+                0.3f);
+            root2.localPosition = Vector3.Lerp(root2.localPosition, newP, 0.3f);
         }
 
         public void SetPos(Transform target)

+ 13 - 1
Assets/Scripts/GameLogic/Combat/Hero/CombatMagicWeaponEntity.cs

@@ -64,7 +64,7 @@ namespace GameLogic.Combat.Hero
             get { return _rootMagicWeaponControl; }
         }
 
-        private BetterList<SkillBasic> allSkill = new BetterList<SkillBasic>();
+        // private BetterList<SkillBasic> allSkill = new BetterList<SkillBasic>();
 
         private SkillBasic skillBasic;
 
@@ -210,8 +210,20 @@ namespace GameLogic.Combat.Hero
             _rootMagicWeaponControl.UseMagicWeapon(this);
         }
 
+        public override void DormancyObj()
+        {
+            base.DormancyObj();
+            _rootMagicWeaponControl = null;
+            _faBaoInfo = null;
+        }
+
         public override void Update(float t)
         {
+            if (_rootMagicWeaponControl == null)
+            {
+                return;
+            }
+
             combatHeroTimeLineControl.Update(t);
             CombatAIBasic?.Update(t);
             CombatHeroSkillControl?.Update(t);

+ 1 - 1
Assets/Scripts/GameLogic/Combat/Hero/State/MagicWeaponChuChangState.cs

@@ -38,7 +38,7 @@ namespace GameLogic.Combat.Hero.State
             myCombatMagicWeaponEntity.GameObject.SetActive(true);
             startPos = myCombatMagicWeaponEntity.RootMagicWeaponControl.combatHeroEntity.dotPos;
             float y = myCombatMagicWeaponEntity.IsEnemy ? 5 : 5;
-            float x = xOff[myCombatMagicWeaponEntity.useIndex];
+            float x = xOff[myCombatMagicWeaponEntity.useIndex%xOff.Length];
 
             endPos = myCombatMagicWeaponEntity.RootMagicWeaponControl.combatHeroEntity.GameObject.transform
                 .TransformPoint(