| @ -1 +1,26 @@ | ||||
| // 角色移动 | ||||
| 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(); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user