Advertisement
Dieton

SlashAnimationInstance.cpp

Dec 13th, 2023
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | Gaming | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3.  
  4. #include "Characters/SlashAnimInstance.h"
  5. #include "Characters\SlashCharacter.h"
  6. #include "GameFramework/CharacterMovementComponent.h"
  7. #include "Kismet\KismetMathLibrary.h"
  8.  
  9. void USlashAnimInstance::NativeInitializeAnimation()
  10. {
  11.     Super::NativeInitializeAnimation();
  12.  
  13.     SlashCharechter = Cast<ASlashCharacter>(TryGetPawnOwner());
  14.     if (SlashCharechter)
  15.     {
  16.         SlashCharacterMovement = SlashCharechter->GetCharacterMovement();
  17.     }
  18. }
  19.  
  20. void USlashAnimInstance::NativeUpdateAnimation(float DeltaTime)
  21. {
  22.     Super::NativeUpdateAnimation(DeltaTime);
  23.  
  24.     if (SlashCharacterMovement)
  25.     {
  26.         GroundSpeed = UKismetMathLibrary::VSizeXY(SlashCharacterMovement->Velocity);
  27.         IsFalling = SlashCharacterMovement->IsFalling();
  28.         CharacterState = SlashCharechter->GetCharacterState();
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement