| 
									
										
										
										
											2025-10-26 15:46:04 +08:00
										 |  |  | 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(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |