Skip to content

Commit 0d0bd8d

Browse files
committed
up
1 parent 0603ab9 commit 0d0bd8d

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed
-5.58 MB
Binary file not shown.

Source/kbengine_ue4_demo/ue4_scripts/GameEntity.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ AGameEntity::AGameEntity(const FObjectInitializer& ObjectInitializer) : Super(Ob
1313
PrimaryActorTick.bCanEverTick = true;
1414
entityID = 0;
1515
moveSpeed = 0.f;
16+
isOnGround = false;
1617
}
1718

1819
// Called when the game starts or when spawned

Source/kbengine_ue4_demo/ue4_scripts/GameEntity.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class KBENGINE_UE4_DEMO_API AGameEntity : public ACharacter
4949
targetRotator = rot;
5050
}
5151

52+
UFUNCTION(BlueprintCallable, Category = "KBEngine")
53+
void setIsOnGround(bool onGround)
54+
{
55+
isOnGround = onGround;
56+
}
57+
5258
public:
5359
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = KBEngine)
5460
float moveSpeed;
@@ -64,4 +70,6 @@ class KBENGINE_UE4_DEMO_API AGameEntity : public ACharacter
6470
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = KBEngine)
6571
FRotator targetRotator;
6672

73+
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = KBEngine)
74+
bool isOnGround;
6775
};

Source/kbengine_ue4_demo/ue4_scripts/GameModeWorld.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ void AGameModeWorld::set_position_Implementation(const UKBEventData* pEventData)
197197
{
198198
pAGameEntity->SetActorLocation(pData->position);
199199
pAGameEntity->setTargetLocation(pData->position);
200+
pAGameEntity->setIsOnGround(pData->isOnGround);
200201
}
201202
}
202203

@@ -218,8 +219,11 @@ void AGameModeWorld::updatePosition_Implementation(const UKBEventData* pEventDat
218219
const UKBEventData_updatePosition* pData = Cast<UKBEventData_updatePosition>(pEventData);
219220
AGameEntity* pAGameEntity = findGameEntity(pData->entityID);
220221

221-
if(pAGameEntity)
222+
if (pAGameEntity)
223+
{
222224
pAGameEntity->setTargetLocation(pData->position);
225+
pAGameEntity->setIsOnGround(pData->isOnGround);
226+
}
223227
}
224228

225229
void AGameModeWorld::onControlled_Implementation(const UKBEventData* pEventData)

0 commit comments

Comments
 (0)