26 lines
		
	
	
		
			745 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			745 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using UnrealSharp.Engine;
 | |
| using UnrealSharp.Attributes;
 | |
| using UnrealSharp.BusyRabbit;
 | |
| using UnrealSharp.GameplayAbilities;
 | |
| using UnrealSharp.CoreUObject;
 | |
| 
 | |
| namespace GameAbilitySystem.Ability.Common;
 | |
| // 角色移动
 | |
| 
 | |
| [UClass]
 | |
| public class UMoveAbility : UBusyGameAbility
 | |
| {
 | |
|     protected override void ActivateAbilityFromEvent(FGameplayEventData eventData)
 | |
|     {
 | |
|         base.ActivateAbilityFromEvent(eventData);
 | |
|         if (UGameplayStatics.GetPlayerController(0) is ALevelPlayerController pc)
 | |
|         {
 | |
|             pc.GetCursorPosition(out FVector2D position);
 | |
|             if (eventData.Instigator is ABusyPawnBase pawn)
 | |
|             {
 | |
|                 pawn.MovementComponent.MoveTo(position);
 | |
|             }
 | |
|         }
 | |
|         EndAbility();
 | |
|     }
 | |
| } |