| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 | 
							- using Animancer;
 
- using GameLogic.Combat.CombatTool;
 
- using UnityEngine;
 
- using UnityEngine.AI;
 
- namespace GameLogic.Combat.Hero.State
 
- {
 
-     public class CombatHeroFollowMoveState : CombatHeroStateBasic
 
-     {
 
-         protected Vector3 lasetTaregtPoint;
 
-         protected Vector3 lastMovePoint;
 
-         protected HeroPlayStateInfoBasic _transitionAsset;
 
-         public float defMoveSpeed;
 
-         public CombatHeroFollowMoveState(CombatHeroEntity combatHeroEntity) : base(combatHeroEntity)
 
-         {
 
-         }
 
-         protected override void ProEnter()
 
-         {
 
-             lasetTaregtPoint = new Vector3(999999, 99999, 99999);
 
-             _transitionAsset = combatHeroEntity.combatHeroAnimtion.Play("run");
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.updateRotation = false;
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.isStopped = true;
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.obstacleAvoidanceType =
 
-                 ObstacleAvoidanceType.HighQualityObstacleAvoidance;
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.avoidancePriority = 20;
 
-             defMoveSpeed = combatHeroEntity.CombatAIBasic.NavMeshAgent.speed;
 
-         }
 
-         protected override void ProExit()
 
-         {
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.speed = defMoveSpeed;
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.isStopped = true;
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.velocity = Vector3.zero;
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.avoidancePriority = 50;
 
-             // combatHeroEntity.CombatAIBasic.NavMeshAgent.acceleration = 0;
 
-         }
 
-         protected void SetNewPath(Vector3 taregtPos)
 
-         {
 
-             lastMovePoint = combatHeroEntity.dotPos;
 
-             lasetTaregtPoint = taregtPos;
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.isStopped = false;
 
-             // combatHeroEntity.CombatAIBasic.NavMeshAgent.acceleration = 8;
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.SetDestination(taregtPos);
 
-         }
 
-         protected override void ProUpdate(float t)
 
-         {
 
-             // if (combatHeroEntity.CombatAIBasic.currFocusTarget == null)
 
-             // {
 
-             //     combatHeroEntity.CombatAIBasic.ChangeState(CombatHeroStateType.idle);
 
-             //     return;
 
-             // }
 
-             Vector3 targetPos = CombatController.currActiveCombat.CombatHeroController.GetFollowPos(combatHeroEntity);
 
-             Vector3 myPos = combatHeroEntity.dotPos;
 
-             float bl = Vector3.SqrMagnitude(lasetTaregtPoint - targetPos) / 1f;
 
-             combatHeroEntity.CombatAIBasic.NavMeshAgent.speed = bl * 2.5f + defMoveSpeed;
 
-             if (Vector3.SqrMagnitude(lasetTaregtPoint - targetPos) > 1)
 
-             {
 
-                 SetNewPath(targetPos);
 
-             }
 
-             else
 
-             {
 
-                 if (Vector3.SqrMagnitude(myPos - targetPos) < 0.1f)
 
-                 {
 
-                     combatHeroEntity.CombatAIBasic.ChangeState(CombatHeroStateType.followIdle);
 
-                     return;
 
-                 }
 
-             }
 
-             if (_transitionAsset != null)
 
-             {
 
-                 float v = combatHeroEntity.CombatAIBasic.NavMeshAgent.velocity.sqrMagnitude;
 
-                 float v2 = v / 36;
 
-                 _transitionAsset.SetSpeed(Mathf.Clamp(v2, 0.2f, 1.5f));
 
-             }
 
-             if (!combatHeroEntity.CombatAIBasic.NavMeshAgent.isStopped)
 
-             {
 
-                 Vector3 nextPos = myPos;
 
-                 Vector3 p = nextPos - lastMovePoint;
 
-                 lastMovePoint = myPos;
 
-                 if (p.sqrMagnitude > 0.0001)
 
-                 {
 
-                     combatHeroEntity.combatHeroGameObject.rotation = Quaternion.Lerp(
 
-                         combatHeroEntity.combatHeroGameObject.rotation, Quaternion.LookRotation(p.normalized), 0.5f);
 
-                 }
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |