Guest User

attackfunc

a guest
Jan 30th, 2017
147
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. void AMasterEnemy::LaunchAttack(UTask_LaunchAttack* AttackTask)
  4. {
  5. //SetActorRotation()
  6. FVector Start = GetActorLocation();
  7. FVector Target = (UGameplayStatics::GetPlayerCharacter(GetWorld(), 0))->GetActorLocation();
  8.  
  9. // probably need to subtract here
  10. FRotator Rot = FRotationMatrix::MakeFromX(Target - Start).Rotator();
  11.  
  12. SetActorRotation(Rot);
  13. GLog->Log("Playing attack montage");
  14. PlayAnimMontage(AttackMontage);
  15.  
  16. float SequenceLength = AttackMontage->CalculateSequenceLength();
  17.  
  18. /*
  19.  
  20. FLatentActionInfo Info;
  21. Info.CallbackTarget = AttackTask;
  22. Info.ExecutionFunction = "OnAttackLaunched";
  23. Info.Linkage = 1;
  24. Info.UUID = 8888;
  25.  
  26.  
  27. UKismetSystemLibrary::Delay(this, SequenceLength, Info);
  28. */
  29.  
  30. //FTimerHandle TimerHandler;
  31. //FTimerDelegate TimerDelegate;
  32. //TimerDelegate.BindUFunction(this, "OnAttackLaunched");
  33.  
  34. //TimerDelegate.BindLambda([&]()
  35. //{
  36. // PlayAnimMontage(AttackMontage);
  37. //});
  38.  
  39. //GetWorld()->GetTimerManager().SetTimer(TimerHandler, TimerDelegate, SequenceLength, false);
  40.  
  41. AttackTask->OnAttackLaunched();
  42.  
  43.  
  44. }
RAW Paste Data