调整关卡切换后的地图数据保存问题
This commit is contained in:
parent
6f67c20a2e
commit
a235d423b5
Binary file not shown.
Binary file not shown.
@ -96,7 +96,8 @@ ManualIPAddress=
|
||||
+ClassRedirects=(OldName="/Script/ProjectFish.Skill_Pull",NewName="/Script/ProjectFish.SkillEffect_Damage")
|
||||
+ClassRedirects=(OldName="/Script/ProjectFish.SkillEffect_Pull",NewName="/Script/ProjectFish.SkillEffect_Damage")
|
||||
+ClassRedirects=(OldName="/Script/ProjectFish.PlayerInventorySubsystem",NewName="/Script/ProjectFish.FishingRodConfigSubsystem")
|
||||
+ClassRedirects=(OldName="/Script/ProjectFish.SimpleMapSystem",NewName="/Script/ProjectFish.FishingMapSystem")
|
||||
+ClassRedirects=(OldName="/Script/ProjectFish.SimpleMapSystem",NewName="/Script/ProjectFish.FishingMapSubSystem")
|
||||
+ClassRedirects=(OldName="/Script/ProjectFish.FishingMapSystem",NewName="/Script/ProjectFish.FishingMapSubSystem")
|
||||
|
||||
[/Script/Engine.CollisionProfile]
|
||||
-Profiles=(Name="NoCollision",CollisionEnabled=NoCollision,ObjectTypeName="WorldStatic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore)),HelpMessage="No collision",bCanModify=False)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -7,7 +7,7 @@
|
||||
#include "ProjectFish/Definations.h"
|
||||
#include "ProjectFish/PawnWithSkill.h"
|
||||
#include "ProjectFish/DataAsset/BagConfigAsset.h"
|
||||
#include "ProjectFish/Subsystem/FishingRodConfigSubsystem.h"
|
||||
#include "ProjectFish/Gameplay/Subsystem/FishingRodConfigSubsystem.h"
|
||||
|
||||
|
||||
// Sets default values for this component's properties
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "FishingMapSystem.h"
|
||||
#include "FishingMapSubSystem.h"
|
||||
#include "Engine/Engine.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "ProjectFish/DataAsset/MapConfigAsset.h"
|
||||
@ -18,17 +18,17 @@ void UFishingMapNode::RandomNodeType()
|
||||
NodeType = static_cast<EMapNodeType>(FMath::RandRange(0, 1));
|
||||
}
|
||||
|
||||
UFishingMapSystem::UFishingMapSystem()
|
||||
UFishingMapSubSystem::UFishingMapSubSystem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void UFishingMapSystem::GenerateMap()
|
||||
void UFishingMapSubSystem::GenerateMap()
|
||||
{
|
||||
GenerateMapWithConfig(MapConfig);
|
||||
}
|
||||
|
||||
void UFishingMapSystem::GenerateMapWithConfig(const UMapConfigAsset* Config)
|
||||
void UFishingMapSubSystem::GenerateMapWithConfig(const UMapConfigAsset* Config)
|
||||
{
|
||||
// 清空现有数据
|
||||
ClearMap();
|
||||
@ -46,7 +46,7 @@ void UFishingMapSystem::GenerateMapWithConfig(const UMapConfigAsset* Config)
|
||||
GetLayerCount(), AllNodes.Num(), AllConnections.Num());
|
||||
}
|
||||
|
||||
int32 UFishingMapSystem::GetNodeAtLayerIndex(FGuid NodeID) const
|
||||
int32 UFishingMapSubSystem::GetNodeAtLayerIndex(FGuid NodeID) const
|
||||
{
|
||||
for (FMapLayer Layer: AllLayers)
|
||||
{
|
||||
@ -59,7 +59,7 @@ int32 UFishingMapSystem::GetNodeAtLayerIndex(FGuid NodeID) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
UFishingMapNode* UFishingMapSystem::GetNode(FGuid NodeID)
|
||||
UFishingMapNode* UFishingMapSubSystem::GetNode(FGuid NodeID)
|
||||
{
|
||||
for (auto node: AllNodes)
|
||||
{
|
||||
@ -69,15 +69,16 @@ UFishingMapNode* UFishingMapSystem::GetNode(FGuid NodeID)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void UFishingMapSystem::ClearMap()
|
||||
void UFishingMapSubSystem::ClearMap()
|
||||
{
|
||||
AllNodes.Empty();
|
||||
AllConnections.Empty();
|
||||
AllLayers.Empty();
|
||||
}
|
||||
|
||||
void UFishingMapSystem::MoveToNode(FGuid NodeID)
|
||||
void UFishingMapSubSystem::MoveToNode(FGuid NodeID)
|
||||
{
|
||||
PlayerPosNodeID = NodeID;
|
||||
TArray<FGuid> MoveableNodeIDs;
|
||||
GetAllConnectedNodes(NodeID, MoveableNodeIDs);
|
||||
for (auto node:AllNodes)
|
||||
@ -104,7 +105,7 @@ void UFishingMapSystem::MoveToNode(FGuid NodeID)
|
||||
}
|
||||
|
||||
|
||||
void UFishingMapSystem::GenerateNodes()
|
||||
void UFishingMapSubSystem::GenerateNodes()
|
||||
{
|
||||
AllLayers.SetNum(MapConfig->TotalLayers);
|
||||
UE_LOG(LogTemp, Warning, TEXT("生成layer层数: %d "), MapConfig->TotalLayers );
|
||||
@ -142,7 +143,7 @@ void UFishingMapSystem::GenerateNodes()
|
||||
}
|
||||
}
|
||||
|
||||
void UFishingMapSystem::CalculateNodePositions()
|
||||
void UFishingMapSubSystem::CalculateNodePositions()
|
||||
{
|
||||
for (int32 LayerIndex = 0; LayerIndex < AllLayers.Num(); ++LayerIndex)
|
||||
{
|
||||
@ -162,7 +163,7 @@ void UFishingMapSystem::CalculateNodePositions()
|
||||
}
|
||||
}
|
||||
|
||||
void UFishingMapSystem::GenerateConnections()
|
||||
void UFishingMapSubSystem::GenerateConnections()
|
||||
{
|
||||
AllConnections.Empty();
|
||||
|
||||
@ -188,7 +189,7 @@ void UFishingMapSystem::GenerateConnections()
|
||||
}
|
||||
}
|
||||
|
||||
TArray<FSimpleConnection> UFishingMapSystem::GenerateNonCrossingConnections(int32 FromLayer, int32 ToLayer)
|
||||
TArray<FSimpleConnection> UFishingMapSubSystem::GenerateNonCrossingConnections(int32 FromLayer, int32 ToLayer)
|
||||
{
|
||||
TArray<FSimpleConnection> Connections;
|
||||
|
||||
@ -258,7 +259,7 @@ TArray<FSimpleConnection> UFishingMapSystem::GenerateNonCrossingConnections(int3
|
||||
return Connections;
|
||||
}
|
||||
|
||||
void UFishingMapSystem::GetAllConnectedNodes(FGuid NodeID, TArray<FGuid>& ConnectedNodes)
|
||||
void UFishingMapSubSystem::GetAllConnectedNodes(FGuid NodeID, TArray<FGuid>& ConnectedNodes)
|
||||
{
|
||||
//获取所有可移动的节点
|
||||
ConnectedNodes.Add(NodeID);
|
||||
@ -3,7 +3,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "ProjectFish/Definations.h"
|
||||
#include "FishingMapSystem.generated.h"
|
||||
#include "FishingMapSubSystem.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnNodeStateChange, FGuid, NodeID, EMapNodeState, NewState);
|
||||
|
||||
@ -45,12 +45,12 @@ public:
|
||||
* 简化的地图生成系统
|
||||
*/
|
||||
UCLASS(BlueprintType)
|
||||
class PROJECTFISH_API UFishingMapSystem : public UObject
|
||||
class PROJECTFISH_API UFishingMapSubSystem : public UGameInstanceSubsystem
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UFishingMapSystem();
|
||||
UFishingMapSubSystem();
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ToolTip = "地图配置"))
|
||||
class UMapConfigAsset* MapConfig;
|
||||
@ -67,6 +67,8 @@ public:
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FOnNodeStateChange OnNodeStateChange;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
FGuid PlayerPosNodeID;
|
||||
// 生成地图
|
||||
UFUNCTION(BlueprintCallable, Category = "FishingMap")
|
||||
void GenerateMap();
|
||||
Loading…
x
Reference in New Issue
Block a user