68 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			68 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
|  | // Fill out your copyright notice in the Description page of Project Settings.
 | |||
|  | 
 | |||
|  | #pragma once
 | |||
|  | 
 | |||
|  | #include "CoreMinimal.h"
 | |||
|  | #include "Engine/Datatable.h"
 | |||
|  | #include "LuaOverriderInterface.h"
 | |||
|  | #include "Subsystems/WorldSubsystem.h"
 | |||
|  | #include "Level/BusyLevelItem.h"
 | |||
|  | #include "BusyActorManagerSubSystem.generated.h"
 | |||
|  | 
 | |||
|  | 
 | |||
|  | USTRUCT(BlueprintType) | |||
|  | struct FBusyLevelBaseConfig : public FTableRowBase { | |||
|  | 	GENERATED_BODY() | |||
|  | 	/* 第一个篝火的位置 */ | |||
|  | 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "初始篝火位置") | |||
|  | 	FVector2D FirstBonfirePosition; | |||
|  | 
 | |||
|  | 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "每次Tick的时间(MS)") | |||
|  | 	int TickInterval; | |||
|  | 
 | |||
|  | 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName = "一个物品生成周期包含的Tick次数") | |||
|  | 	int Period; | |||
|  | 
 | |||
|  | 	UPROPERTY(EditAnywhere, BlueprintReadOnly, DisplayName ="关卡中存在的物品配置") | |||
|  | 	TMap<int32, FBusyLevelItemGenerateConfig> LevelItemIds; | |||
|  | }; | |||
|  | 
 | |||
|  | 
 | |||
|  | /**
 | |||
|  |  *  | |||
|  |  */ | |||
|  | UCLASS() | |||
|  | class BUSYRABBIT_API UBusyActorManagerSubSystem : public UWorldSubsystem, public ILuaOverriderInterface | |||
|  | { | |||
|  | 	GENERATED_BODY() | |||
|  | 
 | |||
|  | public: | |||
|  | 	// 初始化(关卡加载时调用)
 | |||
|  | 	virtual void Initialize(FSubsystemCollectionBase& Collection) override; | |||
|  | 
 | |||
|  | 	virtual void OnWorldBeginPlay(UWorld& InWorld)override; | |||
|  | 
 | |||
|  | 	// 销毁(关卡卸载时调用)
 | |||
|  | 	virtual void Deinitialize() override; | |||
|  | 
 | |||
|  | 	virtual FString GetLuaFilePath_Implementation() const override; | |||
|  | 
 | |||
|  | 
 | |||
|  | public:  // 需要蓝图实现接口
 | |||
|  | 	UFUNCTION(BlueprintImplementableEvent) | |||
|  | 	void ReceiveSubSystemInitialize(); | |||
|  | 	 | |||
|  | 	UFUNCTION(BlueprintImplementableEvent) | |||
|  | 	void ReceiveWorldBeginPlay(); | |||
|  | 
 | |||
|  | public: | |||
|  | 	UFUNCTION(BlueprintPure) | |||
|  | 	bool GetLevelBaseConfig(FBusyLevelBaseConfig& config); | |||
|  | 
 | |||
|  | 	UFUNCTION(BlueprintCallable) | |||
|  | 	UWorld* K2_GetWorld(); | |||
|  | 
 | |||
|  | 	UFUNCTION(BlueprintCallable) | |||
|  | 	static UBusyActorManagerSubSystem* Get(UObject* WorldContextObject); | |||
|  | }; |