private void UpdateMovingAttack(bool inRange) { if (_attackLayer == -1) { _attackLayer = MoveController.GetLayerIndex("Attack Layer"); } GameObject target = Targeting.AttackTarget; SetDesiredAnimationState(global::MoveController.CombatantMoveState.kAttackTarget); Locomotion.MaxSpeed = Character.Model.speed * Combat.AttackMovementSlowFactor; Vector3 direction = (target.transform.position - Character.transform.position).normalized; Vector3 normalizedVelocity = Locomotion.Velocity.normalized; //float speed = (Locomotion.CurrentSpeed > 0) ? 1.0f : 0.0f; if (DEBUG_MOVE_IN_PLACE) { normalizedVelocity = (Locomotion.Destination - Character.transform.position).normalized; //speed = 1.0f; Locomotion.MaxSpeed = 0.0f; } float forward = Vector3.Dot(direction, normalizedVelocity); float lateral = -Vector3.Dot(Vector3.Cross(direction, Vector3.up), normalizedVelocity); if (Mathf.Abs(forward) > Mathf.Abs(lateral)) { lateral = 0; } else { forward = 0; } float currentForward = 1.0f; //AnimController.GetFloat(eCharacterAnimationParameter.ForwardVelocity); float currentLateral = 1.0f; //AnimController.GetFloat(eCharacterAnimationParameter.LateralVelocity); forward = DoTweenUtils.FloatUpdate(currentForward, forward, BLEND_SPEED_STRAFE); lateral = DoTweenUtils.FloatUpdate(currentLateral, lateral, BLEND_SPEED_STRAFE); if (Mathf.Abs(forward) > .9f) { forward = Mathf.Sign(forward); } if (Mathf.Abs(lateral) > .9f) { lateral = Mathf.Sign(lateral); } //AnimController.SetFloat(eCharacterAnimationParameter.Speed, speed); //AnimController.SetFloat(eCharacterAnimationParameter.ForwardVelocity, forward); //AnimController.SetFloat(eCharacterAnimationParameter.LateralVelocity, lateral); if (target != null) { FaceToward(target.transform.position, DEBUG_MOVE_IN_PLACE); } if (inRange) { MoveAttack(target); MoveController.SetLayerWeight(_attackLayer, 1.0f); } else { //AnimController.SetFloat(eCharacterAnimationParameter.Attacking, 0.0f); MoveController.SetLayerWeight(_attackLayer, 0.0f); } Combat.AnimationLayer = _attackLayer; }