// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "Components/GameStateComponent.h" #include "LyraBotCreationComponent.generated.h" class ULyraExperienceDefinition; class ULyraPawnData; class AAIController; UCLASS(Blueprintable, Abstract) class ULyraBotCreationComponent : public UGameStateComponent { GENERATED_BODY() public: ULyraBotCreationComponent(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); //~UActorComponent interface virtual void BeginPlay() override; //~End of UActorComponent interface private: void OnExperienceLoaded(const ULyraExperienceDefinition* Experience); protected: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Gameplay) int32 NumBotsToCreate = 5; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Gameplay) TSubclassOf BotControllerClass; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Gameplay) TArray RandomBotNames; TArray RemainingBotNames; protected: UPROPERTY(Transient) TArray> SpawnedBotList; /** Always creates a single bot */ UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category=Gameplay) virtual void SpawnOneBot(); /** Deletes the last created bot if possible */ UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category=Gameplay) virtual void RemoveOneBot(); /** Spawns bots up to NumBotsToCreate */ UFUNCTION(BlueprintNativeEvent, BlueprintAuthorityOnly, Category=Gameplay) void ServerCreateBots(); #if WITH_SERVER_CODE public: void Cheat_AddBot() { SpawnOneBot(); } void Cheat_RemoveBot() { RemoveOneBot(); } FString CreateBotName(int32 PlayerIndex); #endif };