Pickup Objective Actor

时间:2023-10-01 14:47:20

在角色的头文件中,添加一个布尔变量,设为共有状态,用来判断是否携带目标物体,并暴露给蓝图,类型为仅蓝图可读

    UPROPERTY(BlueprintReadOnly,Category="Gameplay")
bool bIsCarryingObjective;

当NotifyActorBeginOverlap发生时,检查是否与FPSCharacter中的角色发生重叠

AFPSCharacter* MyCharacter = Cast<AFPSCharacter>(OtherActor);
if (MyCharacter)
{
MyCharacter->bIsCarryingObjective = true; Destroy();
}